diff --git a/internal/clients/client.go b/internal/clients/client.go index 69d254488c8c..f0c2154c1e5e 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -353,7 +353,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error if client.Bot, err = bot.NewClient(o); err != nil { return fmt.Errorf("building clients for Bot: %+v", err) } - client.Cdn = cdn.NewClient(o) + if client.Cdn, err = cdn.NewClient(o); err != nil { + return fmt.Errorf("building clients for Cdn: %+v", err) + } if client.CodeSigning, err = codesigning.NewClient(o); err != nil { return fmt.Errorf("building clients for Code Signing: %+v", err) } diff --git a/internal/services/cdn/cdn_frontdoor_custom_domain_resource.go b/internal/services/cdn/cdn_frontdoor_custom_domain_resource.go index b37f6e4bdad8..601eee50bee1 100644 --- a/internal/services/cdn/cdn_frontdoor_custom_domain_resource.go +++ b/internal/services/cdn/cdn_frontdoor_custom_domain_resource.go @@ -8,6 +8,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" dnsValidate "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -120,9 +121,10 @@ func resourceCdnFrontDoorCustomDomain() *pluginsdk.Resource { if !features.FivePointOhBeta() { resource.Schema["tls"].Elem.(*pluginsdk.Resource).Schema["minimum_tls_version"] = &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - Optional: true, - Default: string(cdn.AfdMinimumTLSVersionTLS12), + Type: pluginsdk.TypeString, + Optional: true, + Default: string(cdn.AfdMinimumTLSVersionTLS12), + Deprecated: "As of March 1, 2025, support for 'TLS10' will be retired from Azure Front Door, therefore the 'TLS10' property value will be removed in v5.0 of the provider.", ValidateFunc: validation.StringInSlice([]string{ string(cdn.AfdMinimumTLSVersionTLS12), string(cdn.AfdMinimumTLSVersionTLS10), @@ -138,12 +140,12 @@ func resourceCdnFrontDoorCustomDomainCreate(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - profileId, err := parse.FrontDoorProfileID(d.Get("cdn_frontdoor_profile_id").(string)) + profileId, err := profiles.ParseProfileID(d.Get("cdn_frontdoor_profile_id").(string)) if err != nil { return err } - id := parse.NewFrontDoorCustomDomainID(profileId.SubscriptionId, profileId.ResourceGroup, profileId.ProfileName, d.Get("name").(string)) + id := parse.NewFrontDoorCustomDomainID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.ProfileName, d.Get("name").(string)) existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.CustomDomainName) if err != nil { @@ -211,7 +213,7 @@ func resourceCdnFrontDoorCustomDomainRead(d *pluginsdk.ResourceData, meta interf } d.Set("name", id.CustomDomainName) - d.Set("cdn_frontdoor_profile_id", parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID()) + d.Set("cdn_frontdoor_profile_id", profiles.NewProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID()) if props := resp.AFDDomainProperties; props != nil { d.Set("host_name", props.HostName) diff --git a/internal/services/cdn/cdn_frontdoor_firewall_policy_data_source.go b/internal/services/cdn/cdn_frontdoor_firewall_policy_data_source.go index 4634270d7ca9..11b6efcfaf6b 100644 --- a/internal/services/cdn/cdn_frontdoor_firewall_policy_data_source.go +++ b/internal/services/cdn/cdn_frontdoor_firewall_policy_data_source.go @@ -7,14 +7,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { @@ -66,41 +66,44 @@ func dataSourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { } func dataSourceCdnFrontDoorFirewallPolicyRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient + client := meta.(*clients.Client).Cdn.FrontDoorFirewallPoliciesClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewFrontDoorFirewallPolicyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) - resp, err := client.Get(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + id := waf.NewFrontDoorWebApplicationFirewallPolicyID(subscriptionId, resourceGroup, name) + + result, err := client.PoliciesGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(result.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } - skuName := "" - if sku := resp.Sku; sku != nil { - skuName = string(sku.Name) - } - d.SetId(id.ID()) - d.Set("name", id.FrontDoorWebApplicationFirewallPolicyName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("sku_name", skuName) - - if properties := resp.WebApplicationFirewallPolicyProperties; properties != nil { - if policy := properties.PolicySettings; policy != nil { - d.Set("enabled", policy.EnabledState == frontdoor.PolicyEnabledStateEnabled) - d.Set("mode", string(policy.Mode)) - d.Set("redirect_url", policy.RedirectURL) + + if model := result.Model; model != nil { + d.Set("name", id.FrontDoorWebApplicationFirewallPolicyName) + d.Set("resource_group_name", id.ResourceGroupName) + if sku := model.Sku; sku != nil { + d.Set("sku_name", string(pointer.From(sku.Name))) } - if err := d.Set("frontend_endpoint_ids", flattenFrontendEndpointLinkSlice(properties.FrontendEndpointLinks)); err != nil { - return fmt.Errorf("flattening 'frontend_endpoint_ids': %+v", err) + if props := model.Properties; props != nil { + if err := d.Set("frontend_endpoint_ids", flattenFrontendEndpointLinkSlice(props.FrontendEndpointLinks)); err != nil { + return fmt.Errorf("flattening 'frontend_endpoint_ids': %+v", err) + } + + if policy := props.PolicySettings; policy != nil { + d.Set("enabled", pointer.From(policy.EnabledState) == waf.PolicyEnabledStateEnabled) + d.Set("mode", pointer.From(policy.Mode)) + d.Set("redirect_url", policy.RedirectURL) + } } } diff --git a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go index 20071a4b5ef4..4b295ce41af5 100644 --- a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go +++ b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go @@ -5,17 +5,17 @@ package cdn import ( "fmt" - "log" "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -31,7 +31,7 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Delete: resourceCdnFrontDoorFirewallPolicyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FrontDoorFirewallPolicyID(id) + _, err := waf.ParseFrontDoorWebApplicationFirewallPolicyID(id) return err }), @@ -57,8 +57,8 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.SkuNameStandardAzureFrontDoor), - string(frontdoor.SkuNamePremiumAzureFrontDoor), + string(waf.SkuNameStandardAzureFrontDoor), + string(waf.SkuNamePremiumAzureFrontDoor), }, false), }, @@ -66,8 +66,8 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.PolicyModeDetection), - string(frontdoor.PolicyModePrevention), + string(waf.PolicyModeDetection), + string(waf.PolicyModePrevention), }, false), }, @@ -135,8 +135,8 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.RuleTypeMatchRule), - string(frontdoor.RuleTypeRateLimitRule), + string(waf.RuleTypeMatchRule), + string(waf.RuleTypeRateLimitRule), }, false), }, @@ -156,10 +156,10 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.ActionTypeAllow), - string(frontdoor.ActionTypeBlock), - string(frontdoor.ActionTypeLog), - string(frontdoor.ActionTypeRedirect), + string(waf.ActionTypeAllow), + string(waf.ActionTypeBlock), + string(waf.ActionTypeLog), + string(waf.ActionTypeRedirect), }, false), }, @@ -173,15 +173,15 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.MatchVariableCookies), - string(frontdoor.MatchVariablePostArgs), - string(frontdoor.MatchVariableQueryString), - string(frontdoor.MatchVariableRemoteAddr), - string(frontdoor.MatchVariableRequestBody), - string(frontdoor.MatchVariableRequestHeader), - string(frontdoor.MatchVariableRequestMethod), - string(frontdoor.MatchVariableRequestURI), - string(frontdoor.MatchVariableSocketAddr), + string(waf.MatchVariableCookies), + string(waf.MatchVariablePostArgs), + string(waf.MatchVariableQueryString), + string(waf.MatchVariableRemoteAddr), + string(waf.MatchVariableRequestBody), + string(waf.MatchVariableRequestHeader), + string(waf.MatchVariableRequestMethod), + string(waf.MatchVariableRequestUri), + string(waf.MatchVariableSocketAddr), }, false), }, @@ -199,18 +199,18 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.OperatorAny), - string(frontdoor.OperatorBeginsWith), - string(frontdoor.OperatorContains), - string(frontdoor.OperatorEndsWith), - string(frontdoor.OperatorEqual), - string(frontdoor.OperatorGeoMatch), - string(frontdoor.OperatorGreaterThan), - string(frontdoor.OperatorGreaterThanOrEqual), - string(frontdoor.OperatorIPMatch), - string(frontdoor.OperatorLessThan), - string(frontdoor.OperatorLessThanOrEqual), - string(frontdoor.OperatorRegEx), + string(waf.OperatorAny), + string(waf.OperatorBeginsWith), + string(waf.OperatorContains), + string(waf.OperatorEndsWith), + string(waf.OperatorEqual), + string(waf.OperatorGeoMatch), + string(waf.OperatorGreaterThan), + string(waf.OperatorGreaterThanOrEqual), + string(waf.OperatorIPMatch), + string(waf.OperatorLessThan), + string(waf.OperatorLessThanOrEqual), + string(waf.OperatorRegEx), }, false), }, @@ -233,12 +233,12 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.TransformTypeLowercase), - string(frontdoor.TransformTypeRemoveNulls), - string(frontdoor.TransformTypeTrim), - string(frontdoor.TransformTypeUppercase), - string(frontdoor.TransformTypeURLDecode), - string(frontdoor.TransformTypeURLEncode), + string(waf.TransformTypeLowercase), + string(waf.TransformTypeRemoveNulls), + string(waf.TransformTypeTrim), + string(waf.TransformTypeUppercase), + string(waf.TransformTypeURLDecode), + string(waf.TransformTypeURLEncode), }, false), }, }, @@ -271,10 +271,10 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.ActionTypeAllow), - string(frontdoor.ActionTypeLog), - string(frontdoor.ActionTypeBlock), - string(frontdoor.ActionTypeRedirect), + string(waf.ActionTypeAllow), + string(waf.ActionTypeLog), + string(waf.ActionTypeBlock), + string(waf.ActionTypeRedirect), }, false), }, @@ -288,22 +288,22 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.ManagedRuleExclusionMatchVariableQueryStringArgNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestCookieNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestHeaderNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames), + string(waf.ManagedRuleExclusionMatchVariableQueryStringArgNames), + string(waf.ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), + string(waf.ManagedRuleExclusionMatchVariableRequestCookieNames), + string(waf.ManagedRuleExclusionMatchVariableRequestHeaderNames), + string(waf.ManagedRuleExclusionMatchVariableRequestBodyJsonArgNames), }, false), }, "operator": { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorContains), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEndsWith), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEquals), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEqualsAny), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorStartsWith), + string(waf.ManagedRuleExclusionSelectorMatchOperatorContains), + string(waf.ManagedRuleExclusionSelectorMatchOperatorEndsWith), + string(waf.ManagedRuleExclusionSelectorMatchOperatorEquals), + string(waf.ManagedRuleExclusionSelectorMatchOperatorEqualsAny), + string(waf.ManagedRuleExclusionSelectorMatchOperatorStartsWith), }, false), }, "selector": { @@ -337,22 +337,22 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.ManagedRuleExclusionMatchVariableQueryStringArgNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestCookieNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestHeaderNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames), + string(waf.ManagedRuleExclusionMatchVariableQueryStringArgNames), + string(waf.ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), + string(waf.ManagedRuleExclusionMatchVariableRequestCookieNames), + string(waf.ManagedRuleExclusionMatchVariableRequestHeaderNames), + string(waf.ManagedRuleExclusionMatchVariableRequestBodyJsonArgNames), }, false), }, "operator": { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorContains), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEndsWith), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEquals), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEqualsAny), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorStartsWith), + string(waf.ManagedRuleExclusionSelectorMatchOperatorContains), + string(waf.ManagedRuleExclusionSelectorMatchOperatorEndsWith), + string(waf.ManagedRuleExclusionSelectorMatchOperatorEquals), + string(waf.ManagedRuleExclusionSelectorMatchOperatorEqualsAny), + string(waf.ManagedRuleExclusionSelectorMatchOperatorStartsWith), }, false), }, "selector": { @@ -392,22 +392,22 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.ManagedRuleExclusionMatchVariableQueryStringArgNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestCookieNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestHeaderNames), - string(frontdoor.ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames), + string(waf.ManagedRuleExclusionMatchVariableQueryStringArgNames), + string(waf.ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), + string(waf.ManagedRuleExclusionMatchVariableRequestCookieNames), + string(waf.ManagedRuleExclusionMatchVariableRequestHeaderNames), + string(waf.ManagedRuleExclusionMatchVariableRequestBodyJsonArgNames), }, false), }, "operator": { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorContains), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEndsWith), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEquals), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEqualsAny), - string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorStartsWith), + string(waf.ManagedRuleExclusionSelectorMatchOperatorContains), + string(waf.ManagedRuleExclusionSelectorMatchOperatorEndsWith), + string(waf.ManagedRuleExclusionSelectorMatchOperatorEquals), + string(waf.ManagedRuleExclusionSelectorMatchOperatorEqualsAny), + string(waf.ManagedRuleExclusionSelectorMatchOperatorStartsWith), }, false), }, "selector": { @@ -423,11 +423,11 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoor.ActionTypeAllow), - string(frontdoor.ActionTypeLog), - string(frontdoor.ActionTypeBlock), - string(frontdoor.ActionTypeRedirect), - "AnomalyScoring", // Only valid with 2.0 and above + string(waf.ActionTypeAllow), + string(waf.ActionTypeLog), + string(waf.ActionTypeBlock), + string(waf.ActionTypeRedirect), + string(waf.ActionTypeAnomalyScoring), // Only valid with 2.0 and above }, false), }, }, @@ -454,7 +454,7 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { } func resourceCdnFrontDoorFirewallPolicyCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient + client := meta.(*clients.Client).Cdn.FrontDoorFirewallPoliciesClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -462,33 +462,33 @@ func resourceCdnFrontDoorFirewallPolicyCreate(d *pluginsdk.ResourceData, meta in name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - id := parse.NewFrontDoorFirewallPolicyID(subscriptionId, resourceGroup, name) + id := waf.NewFrontDoorWebApplicationFirewallPolicyID(subscriptionId, resourceGroup, name) - existing, err := client.Get(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + result, err := client.PoliciesGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(result.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(result.HttpResponse) { return tf.ImportAsExistsError("azurerm_cdn_frontdoor_firewall_policy", id.ID()) } - enabled := frontdoor.PolicyEnabledStateDisabled + enabled := waf.PolicyEnabledStateDisabled if d.Get("enabled").(bool) { - enabled = frontdoor.PolicyEnabledStateEnabled + enabled = waf.PolicyEnabledStateEnabled } - requestBodyCheck := frontdoor.PolicyRequestBodyCheckDisabled + requestBodyCheck := waf.PolicyRequestBodyCheckDisabled if d.Get("request_body_check_enabled").(bool) { - requestBodyCheck = frontdoor.PolicyRequestBodyCheckEnabled + requestBodyCheck = waf.PolicyRequestBodyCheckEnabled } sku := d.Get("sku_name").(string) - mode := frontdoor.PolicyMode(d.Get("mode").(string)) + mode := waf.PolicyMode(d.Get("mode").(string)) redirectUrl := d.Get("redirect_url").(string) customBlockResponseStatusCode := d.Get("custom_block_response_status_code").(int) customBlockResponseBody := d.Get("custom_block_response_body").(string) @@ -498,107 +498,104 @@ func resourceCdnFrontDoorFirewallPolicyCreate(d *pluginsdk.ResourceData, meta in return fmt.Errorf("expanding managed_rule: %+v", err) } - if sku != string(frontdoor.SkuNamePremiumAzureFrontDoor) && managedRules != nil { + if sku != string(waf.SkuNamePremiumAzureFrontDoor) && managedRules != nil { return fmt.Errorf("the 'managed_rule' field is only supported with the 'Premium_AzureFrontDoor' sku, got %q", sku) } - t := d.Get("tags").(map[string]interface{}) - - payload := frontdoor.WebApplicationFirewallPolicy{ - Location: utils.String(location.Normalize("Global")), - Sku: &frontdoor.Sku{ - Name: frontdoor.SkuName(sku), + payload := waf.WebApplicationFirewallPolicy{ + Location: pointer.To(location.Normalize("Global")), + Sku: &waf.Sku{ + Name: pointer.To(waf.SkuName(sku)), }, - WebApplicationFirewallPolicyProperties: &frontdoor.WebApplicationFirewallPolicyProperties{ - PolicySettings: &frontdoor.PolicySettings{ - EnabledState: enabled, - Mode: mode, - RequestBodyCheck: requestBodyCheck, + Properties: &waf.WebApplicationFirewallPolicyProperties{ + PolicySettings: &waf.PolicySettings{ + EnabledState: pointer.To(enabled), + Mode: pointer.To(mode), + RequestBodyCheck: pointer.To(requestBodyCheck), }, CustomRules: expandCdnFrontDoorFirewallCustomRules(customRules), }, - Tags: expandFrontDoorTags(tags.Expand(t)), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if managedRules != nil { - payload.WebApplicationFirewallPolicyProperties.ManagedRules = managedRules + payload.Properties.ManagedRules = managedRules } if redirectUrl != "" { - payload.WebApplicationFirewallPolicyProperties.PolicySettings.RedirectURL = utils.String(redirectUrl) + payload.Properties.PolicySettings.RedirectURL = pointer.To(redirectUrl) } if customBlockResponseBody != "" { - payload.WebApplicationFirewallPolicyProperties.PolicySettings.CustomBlockResponseBody = utils.String(customBlockResponseBody) + payload.Properties.PolicySettings.CustomBlockResponseBody = pointer.To(customBlockResponseBody) } if customBlockResponseStatusCode > 0 { - payload.WebApplicationFirewallPolicyProperties.PolicySettings.CustomBlockResponseStatusCode = utils.Int32(int32(customBlockResponseStatusCode)) + payload.Properties.PolicySettings.CustomBlockResponseStatusCode = pointer.To(int64(customBlockResponseStatusCode)) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName, payload) + err = client.PoliciesCreateOrUpdateThenPoll(ctx, id, payload) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceCdnFrontDoorFirewallPolicyRead(d, meta) } func resourceCdnFrontDoorFirewallPolicyUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient + client := meta.(*clients.Client).Cdn.FrontDoorFirewallPoliciesClient ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorFirewallPolicyID(d.Id()) + id, err := waf.ParseFrontDoorWebApplicationFirewallPolicyID(d.Id()) if err != nil { return err } - existing, err := client.Get(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + result, err := client.PoliciesGet(ctx, *id) if err != nil { return fmt.Errorf("retrieving %s: %+v", *id, err) } - if existing.Sku == nil { - return fmt.Errorf("retrieving %s: 'sku' was nil", *id) + model := result.Model + + if model == nil { + return fmt.Errorf("retrieving %s: 'model' was nil", *id) } - if existing.WebApplicationFirewallPolicyProperties == nil { - return fmt.Errorf("retrieving %s: 'properties' was nil", *id) + if model.Properties == nil { + return fmt.Errorf("retrieving %s: 'model.Properties' was nil", *id) } - props := *existing.WebApplicationFirewallPolicyProperties + props := *model.Properties if d.HasChanges("custom_block_response_body", "custom_block_response_status_code", "enabled", "mode", "redirect_url", "request_body_check_enabled") { - enabled := frontdoor.PolicyEnabledStateDisabled + enabled := waf.PolicyEnabledStateDisabled if d.Get("enabled").(bool) { - enabled = frontdoor.PolicyEnabledStateEnabled + enabled = waf.PolicyEnabledStateEnabled } - requestBodyCheck := frontdoor.PolicyRequestBodyCheckDisabled + + requestBodyCheck := waf.PolicyRequestBodyCheckDisabled if d.Get("request_body_check_enabled").(bool) { - requestBodyCheck = frontdoor.PolicyRequestBodyCheckEnabled + requestBodyCheck = waf.PolicyRequestBodyCheckEnabled } - props.PolicySettings = &frontdoor.PolicySettings{ - EnabledState: enabled, - Mode: frontdoor.PolicyMode(d.Get("mode").(string)), - RequestBodyCheck: requestBodyCheck, + props.PolicySettings = &waf.PolicySettings{ + EnabledState: pointer.To(enabled), + Mode: pointer.To(waf.PolicyMode(d.Get("mode").(string))), + RequestBodyCheck: pointer.To(requestBodyCheck), } if redirectUrl := d.Get("redirect_url").(string); redirectUrl != "" { - props.PolicySettings.RedirectURL = utils.String(redirectUrl) + props.PolicySettings.RedirectURL = pointer.To(redirectUrl) } if body := d.Get("custom_block_response_body").(string); body != "" { - props.PolicySettings.CustomBlockResponseBody = utils.String(body) + props.PolicySettings.CustomBlockResponseBody = pointer.To(body) } - if statusCode := d.Get("custom_block_response_status_code").(int); statusCode > 0 { - props.PolicySettings.CustomBlockResponseStatusCode = utils.Int32(int32(statusCode)) + if statusCode := int64(d.Get("custom_block_response_status_code").(int)); statusCode > 0 { + props.PolicySettings.CustomBlockResponseStatusCode = pointer.To(statusCode) } } @@ -607,13 +604,17 @@ func resourceCdnFrontDoorFirewallPolicyUpdate(d *pluginsdk.ResourceData, meta in } if d.HasChange("managed_rule") { + if model.Sku == nil { + return fmt.Errorf("retrieving %s: 'model.Sku' was nil", *id) + } + managedRules, err := expandCdnFrontDoorFirewallManagedRules(d.Get("managed_rule").([]interface{})) if err != nil { return fmt.Errorf("expanding managed_rule: %+v", err) } - if existing.Sku.Name != frontdoor.SkuNamePremiumAzureFrontDoor && managedRules != nil { - return fmt.Errorf("the 'managed_rule' field is only supported when using the sku 'Premium_AzureFrontDoor', got %q", existing.Sku.Name) + if pointer.From(model.Sku.Name) != waf.SkuNamePremiumAzureFrontDoor && managedRules != nil { + return fmt.Errorf("the 'managed_rule' field is only supported when using the sku 'Premium_AzureFrontDoor', got %q", pointer.From(model.Sku.Name)) } if managedRules != nil { @@ -622,145 +623,133 @@ func resourceCdnFrontDoorFirewallPolicyUpdate(d *pluginsdk.ResourceData, meta in } if d.HasChange("tags") { - t := d.Get("tags").(map[string]interface{}) - existing.Tags = expandFrontDoorTags(tags.Expand(t)) + model.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - existing.WebApplicationFirewallPolicyProperties = &props - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName, existing) + model.Properties = pointer.To(props) + + err = client.PoliciesCreateOrUpdateThenPoll(ctx, *id, *model) if err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of %s: %+v", *id, err) - } return resourceCdnFrontDoorFirewallPolicyRead(d, meta) } func resourceCdnFrontDoorFirewallPolicyRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient + client := meta.(*clients.Client).Cdn.FrontDoorFirewallPoliciesClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorFirewallPolicyID(d.Id()) + id, err := waf.ParseFrontDoorWebApplicationFirewallPolicyID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + result, err := client.PoliciesGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Cdn Frontdoor Firewall Policy %q does not exist - removing from state", d.Id()) - d.SetId("") - return nil - } return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.FrontDoorWebApplicationFirewallPolicyName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - skuName := "" - if sku := resp.Sku; sku != nil { - skuName = string(sku.Name) - } - d.Set("sku_name", skuName) - - if properties := resp.WebApplicationFirewallPolicyProperties; properties != nil { - if policy := properties.PolicySettings; policy != nil { - d.Set("enabled", policy.EnabledState == frontdoor.PolicyEnabledStateEnabled) - d.Set("mode", string(policy.Mode)) - d.Set("request_body_check_enabled", policy.RequestBodyCheck == frontdoor.PolicyRequestBodyCheckEnabled) - d.Set("redirect_url", policy.RedirectURL) - d.Set("custom_block_response_status_code", policy.CustomBlockResponseStatusCode) - d.Set("custom_block_response_body", policy.CustomBlockResponseBody) + if model := result.Model; model != nil { + if sku := model.Sku; sku != nil { + d.Set("sku_name", string(pointer.From(sku.Name))) } - if err := d.Set("custom_rule", flattenCdnFrontDoorFirewallCustomRules(properties.CustomRules)); err != nil { - return fmt.Errorf("flattening 'custom_rule': %+v", err) + if props := model.Properties; props != nil { + if err := d.Set("custom_rule", flattenCdnFrontDoorFirewallCustomRules(props.CustomRules)); err != nil { + return fmt.Errorf("flattening 'custom_rule': %+v", err) + } + + if err := d.Set("frontend_endpoint_ids", flattenFrontendEndpointLinkSlice(props.FrontendEndpointLinks)); err != nil { + return fmt.Errorf("flattening 'frontend_endpoint_ids': %+v", err) + } + + if err := d.Set("managed_rule", flattenCdnFrontDoorFirewallManagedRules(props.ManagedRules)); err != nil { + return fmt.Errorf("flattening 'managed_rule': %+v", err) + } + + if policy := props.PolicySettings; policy != nil { + d.Set("enabled", pointer.From(policy.EnabledState) == waf.PolicyEnabledStateEnabled) + d.Set("mode", string(pointer.From(policy.Mode))) + d.Set("request_body_check_enabled", pointer.From(policy.RequestBodyCheck) == waf.PolicyRequestBodyCheckEnabled) + d.Set("redirect_url", policy.RedirectURL) + d.Set("custom_block_response_status_code", int(pointer.From(policy.CustomBlockResponseStatusCode))) + d.Set("custom_block_response_body", policy.CustomBlockResponseBody) + } } - if err := d.Set("frontend_endpoint_ids", flattenFrontendEndpointLinkSlice(properties.FrontendEndpointLinks)); err != nil { - return fmt.Errorf("flattening 'frontend_endpoint_ids': %+v", err) - } - - if err := d.Set("managed_rule", flattenCdnFrontDoorFirewallManagedRules(properties.ManagedRules)); err != nil { - return fmt.Errorf("flattening 'managed_rule': %+v", err) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err } } - if err := tags.FlattenAndSet(d, flattenFrontDoorTags(resp.Tags)); err != nil { - return err - } - return nil } func resourceCdnFrontDoorFirewallPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient + client := meta.(*clients.Client).Cdn.FrontDoorFirewallPoliciesClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorFirewallPolicyID(d.Id()) + id, err := waf.ParseFrontDoorWebApplicationFirewallPolicyID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + err = client.PoliciesDeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } - return nil } -func expandCdnFrontDoorFirewallCustomRules(input []interface{}) *frontdoor.CustomRuleList { +func expandCdnFrontDoorFirewallCustomRules(input []interface{}) *waf.CustomRuleList { if len(input) == 0 { return nil } - output := make([]frontdoor.CustomRule, 0) + output := make([]waf.CustomRule, 0) for _, cr := range input { custom := cr.(map[string]interface{}) - enabled := frontdoor.CustomRuleEnabledStateDisabled + enabled := waf.CustomRuleEnabledStateDisabled if custom["enabled"].(bool) { - enabled = frontdoor.CustomRuleEnabledStateEnabled + enabled = waf.CustomRuleEnabledStateEnabled } name := custom["name"].(string) - priority := int32(custom["priority"].(int)) + priority := int64(custom["priority"].(int)) ruleType := custom["type"].(string) - rateLimitDurationInMinutes := int32(custom["rate_limit_duration_in_minutes"].(int)) - rateLimitThreshold := int32(custom["rate_limit_threshold"].(int)) + rateLimitDurationInMinutes := int64(custom["rate_limit_duration_in_minutes"].(int)) + rateLimitThreshold := int64(custom["rate_limit_threshold"].(int)) matchConditions := expandCdnFrontDoorFirewallMatchConditions(custom["match_condition"].([]interface{})) action := custom["action"].(string) - output = append(output, frontdoor.CustomRule{ - Name: utils.String(name), - Priority: &priority, - EnabledState: enabled, - RuleType: frontdoor.RuleType(ruleType), - RateLimitDurationInMinutes: utils.Int32(rateLimitDurationInMinutes), - RateLimitThreshold: utils.Int32(rateLimitThreshold), - MatchConditions: &matchConditions, - Action: frontdoor.ActionType(action), + output = append(output, waf.CustomRule{ + Name: pointer.To(name), + Priority: priority, + EnabledState: pointer.To(enabled), + RuleType: waf.RuleType(ruleType), + RateLimitDurationInMinutes: pointer.To(rateLimitDurationInMinutes), + RateLimitThreshold: pointer.To(rateLimitThreshold), + MatchConditions: matchConditions, + Action: waf.ActionType(action), }) } - return &frontdoor.CustomRuleList{ + return &waf.CustomRuleList{ Rules: &output, } } -func expandCdnFrontDoorFirewallMatchConditions(input []interface{}) []frontdoor.MatchCondition { - result := make([]frontdoor.MatchCondition, 0) +func expandCdnFrontDoorFirewallMatchConditions(input []interface{}) []waf.MatchCondition { + result := make([]waf.MatchCondition, 0) if len(input) == 0 { return nil } @@ -772,21 +761,21 @@ func expandCdnFrontDoorFirewallMatchConditions(input []interface{}) []frontdoor. selector := match["selector"].(string) operator := match["operator"].(string) negateCondition := match["negation_condition"].(bool) - matchValues := match["match_values"].([]interface{}) + matchValues := utils.ExpandStringSlice(match["match_values"].([]interface{})) transforms := match["transforms"].([]interface{}) - matchCondition := frontdoor.MatchCondition{ - Operator: frontdoor.Operator(operator), + matchCondition := waf.MatchCondition{ + Operator: waf.Operator(operator), NegateCondition: &negateCondition, - MatchValue: utils.ExpandStringSlice(matchValues), + MatchValue: *matchValues, Transforms: expandCdnFrontDoorFirewallTransforms(transforms), } if matchVariable != "" { - matchCondition.MatchVariable = frontdoor.MatchVariable(matchVariable) + matchCondition.MatchVariable = waf.MatchVariable(matchVariable) } if selector != "" { - matchCondition.Selector = utils.String(selector) + matchCondition.Selector = pointer.To(selector) } result = append(result, matchCondition) @@ -795,25 +784,25 @@ func expandCdnFrontDoorFirewallMatchConditions(input []interface{}) []frontdoor. return result } -func expandCdnFrontDoorFirewallTransforms(input []interface{}) *[]frontdoor.TransformType { - result := make([]frontdoor.TransformType, 0) +func expandCdnFrontDoorFirewallTransforms(input []interface{}) *[]waf.TransformType { + result := make([]waf.TransformType, 0) if len(input) == 0 { return nil } for _, v := range input { - result = append(result, frontdoor.TransformType(v.(string))) + result = append(result, waf.TransformType(v.(string))) } return &result } -func expandCdnFrontDoorFirewallManagedRules(input []interface{}) (*frontdoor.ManagedRuleSetList, error) { +func expandCdnFrontDoorFirewallManagedRules(input []interface{}) (*waf.ManagedRuleSetList, error) { if len(input) == 0 { return nil, nil } - result := make([]frontdoor.ManagedRuleSet, 0) + result := make([]waf.ManagedRuleSet, 0) for _, mr := range input { managedRule := mr.(map[string]interface{}) @@ -842,27 +831,27 @@ func expandCdnFrontDoorFirewallManagedRules(input []interface{}) (*frontdoor.Man return nil, err } - managedRuleSet := frontdoor.ManagedRuleSet{ + managedRuleSet := waf.ManagedRuleSet{ Exclusions: exclusions, - RuleSetVersion: &version, + RuleSetVersion: version, RuleGroupOverrides: ruleGroupOverrides, - RuleSetType: &ruleType, + RuleSetType: ruleType, } if action != "" { - managedRuleSet.RuleSetAction = frontdoor.ManagedRuleSetActionType(action) + managedRuleSet.RuleSetAction = pointer.To(waf.ManagedRuleSetActionType(action)) } result = append(result, managedRuleSet) } - return &frontdoor.ManagedRuleSetList{ + return &waf.ManagedRuleSetList{ ManagedRuleSets: &result, }, nil } -func expandCdnFrontDoorFirewallManagedRuleGroupExclusion(input []interface{}) *[]frontdoor.ManagedRuleExclusion { - results := make([]frontdoor.ManagedRuleExclusion, 0) +func expandCdnFrontDoorFirewallManagedRuleGroupExclusion(input []interface{}) *[]waf.ManagedRuleExclusion { + results := make([]waf.ManagedRuleExclusion, 0) if len(input) == 0 { return nil } @@ -874,18 +863,18 @@ func expandCdnFrontDoorFirewallManagedRuleGroupExclusion(input []interface{}) *[ operator := exclusion["operator"].(string) selector := exclusion["selector"].(string) - results = append(results, frontdoor.ManagedRuleExclusion{ - MatchVariable: frontdoor.ManagedRuleExclusionMatchVariable(matchVariable), - SelectorMatchOperator: frontdoor.ManagedRuleExclusionSelectorMatchOperator(operator), - Selector: &selector, + results = append(results, waf.ManagedRuleExclusion{ + MatchVariable: waf.ManagedRuleExclusionMatchVariable(matchVariable), + SelectorMatchOperator: waf.ManagedRuleExclusionSelectorMatchOperator(operator), + Selector: selector, }) } return &results } -func expandCdnFrontDoorFirewallManagedRuleGroupOverride(input []interface{}, versionRaw string, version float64) (*[]frontdoor.ManagedRuleGroupOverride, error) { - result := make([]frontdoor.ManagedRuleGroupOverride, 0) +func expandCdnFrontDoorFirewallManagedRuleGroupOverride(input []interface{}, versionRaw string, version float64) (*[]waf.ManagedRuleGroupOverride, error) { + result := make([]waf.ManagedRuleGroupOverride, 0) if len(input) == 0 { return nil, nil } @@ -900,9 +889,9 @@ func expandCdnFrontDoorFirewallManagedRuleGroupOverride(input []interface{}, ver return nil, err } - result = append(result, frontdoor.ManagedRuleGroupOverride{ + result = append(result, waf.ManagedRuleGroupOverride{ Exclusions: exclusions, - RuleGroupName: &ruleGroupName, + RuleGroupName: ruleGroupName, Rules: rules, }) } @@ -910,8 +899,8 @@ func expandCdnFrontDoorFirewallManagedRuleGroupOverride(input []interface{}, ver return &result, nil } -func expandCdnFrontDoorFirewallRuleOverride(input []interface{}, versionRaw string, version float64) (*[]frontdoor.ManagedRuleOverride, error) { - result := make([]frontdoor.ManagedRuleOverride, 0) +func expandCdnFrontDoorFirewallRuleOverride(input []interface{}, versionRaw string, version float64) (*[]waf.ManagedRuleOverride, error) { + result := make([]waf.ManagedRuleOverride, 0) if len(input) == 0 { return nil, nil } @@ -919,29 +908,28 @@ func expandCdnFrontDoorFirewallRuleOverride(input []interface{}, versionRaw stri for _, v := range input { rule := v.(map[string]interface{}) - enabled := frontdoor.ManagedRuleEnabledStateDisabled + enabled := waf.ManagedRuleEnabledStateDisabled if rule["enabled"].(bool) { - enabled = frontdoor.ManagedRuleEnabledStateEnabled + enabled = waf.ManagedRuleEnabledStateEnabled } ruleId := rule["rule_id"].(string) - actionTypeRaw := rule["action"].(string) - action := frontdoor.ActionType(actionTypeRaw) + action := waf.ActionType(rule["action"].(string)) // NOTE: Default Rule Sets(DRS) 2.0 and above rules only use action type of 'AnomalyScoring' or 'Log'. Issues 19088 and 19561 // This will still work for bot rules as well since it will be the default value of 1.0 - if version < 2.0 && actionTypeRaw == "AnomalyScoring" { + if version < 2.0 && action == waf.ActionTypeAnomalyScoring { return nil, fmt.Errorf("'AnomalyScoring' is only valid in managed rules that are DRS 2.0 and above, got %q", versionRaw) - } else if version >= 2.0 && actionTypeRaw != "AnomalyScoring" && actionTypeRaw != "Log" { + } else if version >= 2.0 && action != waf.ActionTypeAnomalyScoring && action != waf.ActionTypeLog { return nil, fmt.Errorf("the managed rules 'action' field must be set to 'AnomalyScoring' or 'Log' if the managed rule is DRS 2.0 or above, got %q", action) } exclusions := expandCdnFrontDoorFirewallManagedRuleGroupExclusion(rule["exclusion"].([]interface{})) - result = append(result, frontdoor.ManagedRuleOverride{ - RuleID: &ruleId, - EnabledState: enabled, - Action: action, + result = append(result, waf.ManagedRuleOverride{ + RuleId: ruleId, + EnabledState: pointer.To(enabled), + Action: pointer.To(action), Exclusions: exclusions, }) } @@ -949,21 +937,20 @@ func expandCdnFrontDoorFirewallRuleOverride(input []interface{}, versionRaw stri return &result, nil } -func flattenCdnFrontDoorFirewallCustomRules(input *frontdoor.CustomRuleList) []interface{} { +func flattenCdnFrontDoorFirewallCustomRules(input *waf.CustomRuleList) []interface{} { if input == nil || input.Rules == nil { return []interface{}{} } results := make([]interface{}, 0) for _, v := range *input.Rules { - action := "" - if v.Action != "" { - action = string(v.Action) - } + action := string(v.Action) + priority := int(v.Priority) + ruleType := string(v.RuleType) enabled := false - if v.EnabledState != "" { - enabled = v.EnabledState == frontdoor.CustomRuleEnabledStateEnabled + if v.EnabledState != nil { + enabled = pointer.From(v.EnabledState) == waf.CustomRuleEnabledStateEnabled } name := "" @@ -971,11 +958,6 @@ func flattenCdnFrontDoorFirewallCustomRules(input *frontdoor.CustomRuleList) []i name = *v.Name } - priority := 0 - if v.Priority != nil { - priority = int(*v.Priority) - } - rateLimitDurationInMinutes := 0 if v.RateLimitDurationInMinutes != nil { rateLimitDurationInMinutes = int(*v.RateLimitDurationInMinutes) @@ -986,11 +968,6 @@ func flattenCdnFrontDoorFirewallCustomRules(input *frontdoor.CustomRuleList) []i rateLimitThreshold = int(*v.RateLimitThreshold) } - ruleType := "" - if v.RuleType != "" { - ruleType = string(v.RuleType) - } - results = append(results, map[string]interface{}{ "action": action, "enabled": enabled, @@ -1006,13 +983,13 @@ func flattenCdnFrontDoorFirewallCustomRules(input *frontdoor.CustomRuleList) []i return results } -func flattenCdnFrontDoorFirewallMatchConditions(input *[]frontdoor.MatchCondition) []interface{} { +func flattenCdnFrontDoorFirewallMatchConditions(input []waf.MatchCondition) []interface{} { if input == nil { return []interface{}{} } results := make([]interface{}, 0) - for _, v := range *input { + for _, v := range input { selector := "" if v.Selector != nil { selector = *v.Selector @@ -1036,27 +1013,16 @@ func flattenCdnFrontDoorFirewallMatchConditions(input *[]frontdoor.MatchConditio return results } -func flattenCdnFrontDoorFirewallManagedRules(input *frontdoor.ManagedRuleSetList) []interface{} { +func flattenCdnFrontDoorFirewallManagedRules(input *waf.ManagedRuleSetList) []interface{} { if input == nil || input.ManagedRuleSets == nil { return []interface{}{} } results := make([]interface{}, 0) for _, r := range *input.ManagedRuleSets { - ruleSetType := "" - if r.RuleSetType != nil { - ruleSetType = *r.RuleSetType - } - - ruleSetVersion := "" - if r.RuleSetVersion != nil { - ruleSetVersion = *r.RuleSetVersion - } - - ruleSetAction := "" - if r.RuleSetAction != "" { - ruleSetAction = string(r.RuleSetAction) - } + ruleSetType := r.RuleSetType + ruleSetVersion := r.RuleSetVersion + ruleSetAction := string(pointer.From(r.RuleSetAction)) results = append(results, map[string]interface{}{ "exclusion": flattenCdnFrontDoorFirewallExclusions(r.Exclusions), @@ -1070,27 +1036,16 @@ func flattenCdnFrontDoorFirewallManagedRules(input *frontdoor.ManagedRuleSetList return results } -func flattenCdnFrontDoorFirewallExclusions(input *[]frontdoor.ManagedRuleExclusion) []interface{} { +func flattenCdnFrontDoorFirewallExclusions(input *[]waf.ManagedRuleExclusion) []interface{} { if input == nil { return []interface{}{} } results := make([]interface{}, 0) for _, v := range *input { - matchVariable := "" - if v.MatchVariable != "" { - matchVariable = string(v.MatchVariable) - } - - operator := "" - if v.SelectorMatchOperator != "" { - operator = string(v.SelectorMatchOperator) - } - - selector := "" - if v.Selector != nil { - selector = *v.Selector - } + matchVariable := string(v.MatchVariable) + operator := string(v.SelectorMatchOperator) + selector := v.Selector results = append(results, map[string]interface{}{ "match_variable": matchVariable, @@ -1102,17 +1057,14 @@ func flattenCdnFrontDoorFirewallExclusions(input *[]frontdoor.ManagedRuleExclusi return results } -func flattenCdnFrontDoorFirewallOverrides(input *[]frontdoor.ManagedRuleGroupOverride) []interface{} { +func flattenCdnFrontDoorFirewallOverrides(input *[]waf.ManagedRuleGroupOverride) []interface{} { if input == nil { return []interface{}{} } results := make([]interface{}, 0) for _, v := range *input { - ruleGroupName := "" - if v.RuleGroupName != nil { - ruleGroupName = *v.RuleGroupName - } + ruleGroupName := v.RuleGroupName results = append(results, map[string]interface{}{ "rule_group_name": ruleGroupName, @@ -1124,27 +1076,19 @@ func flattenCdnFrontDoorFirewallOverrides(input *[]frontdoor.ManagedRuleGroupOve return results } -func flattenCdnFrontDoorFirewallRules(input *[]frontdoor.ManagedRuleOverride) []interface{} { +func flattenCdnFrontDoorFirewallRules(input *[]waf.ManagedRuleOverride) []interface{} { if input == nil { return []interface{}{} } results := make([]interface{}, 0) for _, v := range *input { - action := "AnomalyScoring" - if v.Action != "" { - action = string(v.Action) - } - - enabled := false - if v.EnabledState != "" { - enabled = v.EnabledState == frontdoor.ManagedRuleEnabledStateEnabled - } - - ruleId := "" - if v.RuleID != nil { - ruleId = *v.RuleID + action := waf.ActionTypeAnomalyScoring + if v.Action != nil { + action = pointer.From(v.Action) } + enabled := pointer.From(v.EnabledState) == waf.ManagedRuleEnabledStateEnabled + ruleId := v.RuleId results = append(results, map[string]interface{}{ "action": action, diff --git a/internal/services/cdn/cdn_frontdoor_helpers.go b/internal/services/cdn/cdn_frontdoor_helpers.go index 24298240ba3f..dbdb3da229a6 100644 --- a/internal/services/cdn/cdn_frontdoor_helpers.go +++ b/internal/services/cdn/cdn_frontdoor_helpers.go @@ -7,9 +7,9 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck - "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck dnsValidate "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" + waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/azuresdkhacks" @@ -108,64 +108,31 @@ func flattenHttpsRedirectToBool(input cdn.HTTPSRedirect) bool { return input == cdn.HTTPSRedirectEnabled } -func expandFrontDoorTags(tagMap *map[string]string) map[string]*string { - t := make(map[string]*string) - - if tagMap != nil { - for k, v := range *tagMap { - tagKey := k - tagValue := v - t[tagKey] = &tagValue - } - } - - return t -} - -func flattenFrontDoorTags(tagMap map[string]*string) *map[string]string { - t := make(map[string]string) - - for k, v := range tagMap { - tagKey := k - tagValue := v - if tagValue == nil { - continue - } - t[tagKey] = *tagValue - } - - return &t -} - -func flattenTransformSlice(input *[]frontdoor.TransformType) []interface{} { +func flattenTransformSlice(input *[]waf.TransformType) []interface{} { result := make([]interface{}, 0) if input == nil || len(*input) == 0 { return result } - if input != nil { - for _, item := range *input { - result = append(result, string(item)) - } + for _, item := range *input { + result = append(result, string(item)) } return result } -func flattenFrontendEndpointLinkSlice(input *[]frontdoor.FrontendEndpointLink) []interface{} { +func flattenFrontendEndpointLinkSlice(input *[]waf.FrontendEndpointLink) []interface{} { result := make([]interface{}, 0) if input == nil || len(*input) == 0 { return result } - if input != nil { - for _, item := range *input { - if item.ID == nil { - continue - } - - result = append(result, *item.ID) + for _, item := range *input { + if item.Id == nil { + continue } + + result = append(result, *item.Id) } return result diff --git a/internal/services/cdn/cdn_frontdoor_origin_resource.go b/internal/services/cdn/cdn_frontdoor_origin_resource.go index 430ccfd7d531..2900e0153419 100644 --- a/internal/services/cdn/cdn_frontdoor_origin_resource.go +++ b/internal/services/cdn/cdn_frontdoor_origin_resource.go @@ -8,8 +8,11 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-11-01/privatelinkservices" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -152,7 +155,7 @@ func resourceCdnFrontDoorOrigin() *pluginsdk.Resource { func resourceCdnFrontDoorOriginCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Cdn.FrontDoorOriginsClient - profileClient := meta.(*clients.Client).Cdn.FrontDoorProfileClient + profileClient := meta.(*clients.Client).Cdn.FrontDoorProfilesClient ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -177,21 +180,31 @@ func resourceCdnFrontDoorOriginCreate(d *pluginsdk.ResourceData, meta interface{ // I need to get the profile SKU so I know if it is valid or not to define a private link as // private links are only allowed in the premium sku... - profileId := parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName) + profileId := profiles.NewProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName) - profile, err := profileClient.Get(ctx, profileId.ResourceGroup, profileId.ProfileName) + profileResp, err := profileClient.Get(ctx, profileId) if err != nil { - if utils.ResponseWasNotFound(profile.Response) { + if response.WasNotFound(profileResp.HttpResponse) { return fmt.Errorf("retrieving parent %s: not found", profileId) } return fmt.Errorf("retrieving parent %s: %+v", profileId, err) } - if profile.Sku == nil { - return fmt.Errorf("retrieving parent %s: 'sku' was nil", profileId) + profileModel := profileResp.Model + + if profileModel == nil { + return fmt.Errorf("profileModel is 'nil'") + } + + if profileModel.Properties == nil { + return fmt.Errorf("profileModel.Properties is 'nil'") + } + + if profileModel.Sku.Name == nil { + return fmt.Errorf("profileModel.Sku.Name' is 'nil'") } - skuName := profile.Sku.Name + skuName := string(pointer.From(profileModel.Sku.Name)) var enabled bool if !pluginsdk.IsExplicitlyNullInConfig(d, "enabled") { @@ -213,7 +226,7 @@ func resourceCdnFrontDoorOriginCreate(d *pluginsdk.ResourceData, meta interface{ props.OriginHostHeader = utils.String(originHostHeader) } - expanded, err := expandPrivateLinkSettings(d.Get("private_link").([]interface{}), skuName, enableCertNameCheck) + expanded, err := expandPrivateLinkSettings(d.Get("private_link").([]interface{}), profiles.SkuName(skuName), enableCertNameCheck) if err != nil { return err } @@ -279,7 +292,7 @@ func resourceCdnFrontDoorOriginRead(d *pluginsdk.ResourceData, meta interface{}) func resourceCdnFrontDoorOriginUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Cdn.FrontDoorOriginsClient workaroundClient := azuresdkhacks.NewCdnFrontDoorOriginsWorkaroundClient(client) - profileClient := meta.(*clients.Client).Cdn.FrontDoorProfileClient + profileClient := meta.(*clients.Client).Cdn.FrontDoorProfilesClient ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -320,24 +333,29 @@ func resourceCdnFrontDoorOriginUpdate(d *pluginsdk.ResourceData, meta interface{ if d.HasChange("private_link") { // I need to get the profile SKU so I know if it is valid or not to define a private link as // private links are only allowed in the premium sku... - profileId := parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName) - profile, err := profileClient.Get(ctx, profileId.ResourceGroup, profileId.ProfileName) + profileId := profiles.NewProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName) + + profileResp, err := profileClient.Get(ctx, profileId) if err != nil { - if utils.ResponseWasNotFound(profile.Response) { + if response.WasNotFound(profileResp.HttpResponse) { return fmt.Errorf("retrieving parent %s: not found", profileId) } return fmt.Errorf("retrieving parent %s: %+v", profileId, err) } - if profile.Sku == nil { - return fmt.Errorf("retrieving parent %s: 'sku' was nil", profileId) + profileModel := profileResp.Model + + if profileModel == nil { + return fmt.Errorf("profileModel is 'nil'") } - skuName := profile.Sku.Name + if profileModel.Sku.Name == nil { + return fmt.Errorf("retrieving parent %s: 'profileModel.Sku.Name' was 'nil'", profileId) + } enableCertNameCheck := d.Get("certificate_name_check_enabled").(bool) - privateLinkSettings, err := expandPrivateLinkSettings(d.Get("private_link").([]interface{}), skuName, enableCertNameCheck) + privateLinkSettings, err := expandPrivateLinkSettings(d.Get("private_link").([]interface{}), pointer.From(profileModel.Sku.Name), enableCertNameCheck) if err != nil { return err } @@ -408,14 +426,14 @@ func resourceCdnFrontDoorOriginDelete(d *pluginsdk.ResourceData, meta interface{ return nil } -func expandPrivateLinkSettings(input []interface{}, skuName cdn.SkuName, enableCertNameCheck bool) (*cdn.SharedPrivateLinkResourceProperties, error) { +func expandPrivateLinkSettings(input []interface{}, skuName profiles.SkuName, enableCertNameCheck bool) (*cdn.SharedPrivateLinkResourceProperties, error) { if len(input) == 0 { // NOTE: This cannot return an empty object, the service team requires this to be set to nil else you will get the following error during creation: // Property 'AfdOrigin.SharedPrivateLinkResource.PrivateLink' is required but it was not set; Property 'AfdOrigin.SharedPrivateLinkResource.RequestMessage' is required but it was not set return nil, nil } - if skuName != cdn.SkuNamePremiumAzureFrontDoor { + if skuName != profiles.SkuNamePremiumAzureFrontDoor { return nil, fmt.Errorf("the 'private_link' field can only be configured when the Frontdoor Profile is using a 'Premium_AzureFrontDoor' SKU, got %q", skuName) } diff --git a/internal/services/cdn/cdn_frontdoor_profile_data_source.go b/internal/services/cdn/cdn_frontdoor_profile_data_source.go index 2cbf7fb91055..f0e4163e1de1 100644 --- a/internal/services/cdn/cdn_frontdoor_profile_data_source.go +++ b/internal/services/cdn/cdn_frontdoor_profile_data_source.go @@ -7,14 +7,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceCdnFrontDoorProfile() *pluginsdk.Resource { @@ -55,40 +56,42 @@ func dataSourceCdnFrontDoorProfile() *pluginsdk.Resource { } func dataSourceCdnFrontDoorProfileRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + client := meta.(*clients.Client).Cdn.FrontDoorProfilesClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewFrontDoorProfileID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName) + id := profiles.NewProfileID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.ProfileName) - d.Set("resource_group_name", id.ResourceGroup) - if props := resp.ProfileProperties; props != nil { - d.Set("response_timeout_seconds", props.OriginResponseTimeoutSeconds) + if model := resp.Model; model != nil { + d.Set("name", id.ProfileName) + d.Set("resource_group_name", id.ResourceGroupName) - // whilst this is returned in the API as FrontDoorID other resources refer to - // this as the Resource GUID, so we will for consistency - d.Set("resource_guid", props.FrontDoorID) - } + if skuName := model.Sku.Name; skuName != nil { + d.Set("sku_name", string(pointer.From(skuName))) + } - skuName := "" - if resp.Sku != nil { - skuName = string(resp.Sku.Name) - } - d.Set("sku_name", skuName) + if props := model.Properties; props != nil { + d.Set("response_timeout_seconds", int(pointer.From(props.OriginResponseTimeoutSeconds))) - if err := tags.FlattenAndSet(d, resp.Tags); err != nil { - return err + // whilst this is returned in the API as FrontDoorID other resources refer to + // this as the Resource GUID, so we will for consistency + d.Set("resource_guid", pointer.From(props.FrontDoorId)) + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } return nil diff --git a/internal/services/cdn/cdn_frontdoor_profile_resource.go b/internal/services/cdn/cdn_frontdoor_profile_resource.go index 9d95ea1a49e2..0fca6291c6c6 100644 --- a/internal/services/cdn/cdn_frontdoor_profile_resource.go +++ b/internal/services/cdn/cdn_frontdoor_profile_resource.go @@ -7,18 +7,18 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceCdnFrontDoorProfile() *pluginsdk.Resource { @@ -36,7 +36,7 @@ func resourceCdnFrontDoorProfile() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FrontDoorProfileID(id) + _, err := profiles.ParseProfileID(id) return err }), @@ -62,8 +62,8 @@ func resourceCdnFrontDoorProfile() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.SkuNamePremiumAzureFrontDoor), - string(cdn.SkuNameStandardAzureFrontDoor), + string(profiles.SkuNamePremiumAzureFrontDoor), + string(profiles.SkuNameStandardAzureFrontDoor), }, false), }, @@ -78,60 +78,57 @@ func resourceCdnFrontDoorProfile() *pluginsdk.Resource { } func resourceCdnFrontDoorProfileCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + client := meta.(*clients.Client).Cdn.FrontDoorProfilesClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewFrontDoorProfileID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName) + id := profiles.NewProfileID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_cdn_frontdoor_profile", id.ID()) } - props := cdn.Profile{ - Location: utils.String(location.Normalize("global")), - ProfileProperties: &cdn.ProfileProperties{ - OriginResponseTimeoutSeconds: utils.Int32(int32(d.Get("response_timeout_seconds").(int))), + props := profiles.Profile{ + Location: location.Normalize("global"), + Properties: &profiles.ProfileProperties{ + OriginResponseTimeoutSeconds: pointer.To(int64(d.Get("response_timeout_seconds").(int))), }, - Sku: &cdn.Sku{ - Name: cdn.SkuName(d.Get("sku_name").(string)), + Sku: profiles.Sku{ + Name: pointer.To(profiles.SkuName(d.Get("sku_name").(string))), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Create(ctx, id.ResourceGroup, id.ProfileName, props) + err = client.CreateThenPoll(ctx, id, props) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceCdnFrontDoorProfileRead(d, meta) } func resourceCdnFrontDoorProfileRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + client := meta.(*clients.Client).Cdn.FrontDoorProfilesClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorProfileID(d.Id()) + id, err := profiles.ParseProfileID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -139,74 +136,70 @@ func resourceCdnFrontDoorProfileRead(d *pluginsdk.ResourceData, meta interface{} } d.Set("name", id.ProfileName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.ProfileProperties; props != nil { - d.Set("response_timeout_seconds", props.OriginResponseTimeoutSeconds) + if model := resp.Model; model != nil { + if skuName := model.Sku.Name; skuName != nil { + d.Set("sku_name", string(pointer.From(skuName))) + } - // whilst this is returned in the API as FrontDoorID other resources refer to - // this as the Resource GUID, so we will for consistency - d.Set("resource_guid", props.FrontDoorID) - } + if props := model.Properties; props != nil { + d.Set("response_timeout_seconds", int(pointer.From(props.OriginResponseTimeoutSeconds))) + + // whilst this is returned in the API as FrontDoorID other resources refer to + // this as the Resource GUID, so we will for consistency + d.Set("resource_guid", pointer.From(props.FrontDoorId)) + } - skuName := "" - if resp.Sku != nil { - skuName = string(resp.Sku.Name) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - d.Set("sku_name", skuName) - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceCdnFrontDoorProfileUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + client := meta.(*clients.Client).Cdn.FrontDoorProfilesClient ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorProfileID(d.Id()) + id, err := profiles.ParseProfileID(d.Id()) if err != nil { return err } - props := cdn.ProfileUpdateParameters{ - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), - ProfilePropertiesUpdateParameters: &cdn.ProfilePropertiesUpdateParameters{}, + props := profiles.ProfileUpdateParameters{ + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + Properties: &profiles.ProfilePropertiesUpdateParameters{}, } if d.HasChange("response_timeout_seconds") { - props.OriginResponseTimeoutSeconds = utils.Int32(int32(d.Get("response_timeout_seconds").(int))) + props.Properties.OriginResponseTimeoutSeconds = pointer.To(int64(d.Get("response_timeout_seconds").(int))) } - future, err := client.Update(ctx, id.ResourceGroup, id.ProfileName, props) + err = client.UpdateThenPoll(ctx, pointer.From(id), props) if err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of %s: %+v", *id, err) - } - return resourceCdnFrontDoorProfileRead(d, meta) } func resourceCdnFrontDoorProfileDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + client := meta.(*clients.Client).Cdn.FrontDoorProfilesClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorProfileID(d.Id()) + id, err := profiles.ParseProfileID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ProfileName) + err = client.DeleteThenPoll(ctx, pointer.From(id)) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } - return nil } diff --git a/internal/services/cdn/cdn_frontdoor_profile_resource_test.go b/internal/services/cdn/cdn_frontdoor_profile_resource_test.go index 1c4a0aab09cc..28ce501fe59f 100644 --- a/internal/services/cdn/cdn_frontdoor_profile_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_profile_resource_test.go @@ -8,10 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" "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/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -84,15 +86,15 @@ func TestAccCdnFrontDoorProfile_update(t *testing.T) { } func (r CdnFrontDoorProfileResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.FrontDoorProfileID(state.ID) + id, err := profiles.ParseProfileID(state.ID) if err != nil { return nil, err } - client := clients.Cdn.FrontDoorProfileClient - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName) + client := clients.Cdn.FrontDoorProfilesClient + resp, err := client.Get(ctx, pointer.From(id)) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %s: %+v", id, err) diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource.go b/internal/services/cdn/cdn_frontdoor_rule_resource.go index 03acdc252a4a..fa7597ec325a 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource.go @@ -7,7 +7,7 @@ import ( "fmt" "time" - cdn "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" cdnFrontDoorRuleActions "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorruleactions" diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource_test.go b/internal/services/cdn/cdn_frontdoor_rule_resource_test.go index 425f1a75c6b1..2690c51a6e92 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource_test.go @@ -994,13 +994,10 @@ resource "azurerm_cdn_frontdoor_rule" "test" { cache_duration = "365.23:59:59" } - url_redirect_action { - redirect_type = "PermanentRedirect" - redirect_protocol = "MatchRequest" - query_string = "clientIp={client_ip}" - destination_path = "/exampleredirection" - destination_hostname = "contoso.com" - destination_fragment = "UrlRedirect" + response_header_action { + header_action = "Append" + header_name = "Set-Cookie" + value = "sessionId=12345678" } } diff --git a/internal/services/cdn/cdn_frontdoor_security_policy_resource.go b/internal/services/cdn/cdn_frontdoor_security_policy_resource.go index cddfbfaed40a..11a9f791bded 100644 --- a/internal/services/cdn/cdn_frontdoor_security_policy_resource.go +++ b/internal/services/cdn/cdn_frontdoor_security_policy_resource.go @@ -8,10 +8,13 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies" + waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - cdnfrontdoorsecurityparams "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorsecurityparams" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -33,7 +36,7 @@ func resourceCdnFrontDoorSecurityPolicy() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FrontDoorSecurityPolicyID(id) + _, err := securitypolicies.ParseSecurityPolicyID(id) return err }), @@ -140,57 +143,58 @@ func resourceCdnFrontdoorSecurityPolicyCreate(d *pluginsdk.ResourceData, meta in defer cancel() // NOTE: The profile id is used to retrieve properties from the related profile that must match in this security policy - profile, err := parse.FrontDoorProfileID(d.Get("cdn_frontdoor_profile_id").(string)) + profileId, err := profiles.ParseProfileID(d.Get("cdn_frontdoor_profile_id").(string)) if err != nil { return err } securityPolicyName := d.Get("name").(string) - id := parse.NewFrontDoorSecurityPolicyID(profile.SubscriptionId, profile.ResourceGroup, profile.ProfileName, securityPolicyName) + id := securitypolicies.NewSecurityPolicyID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.ProfileName, securityPolicyName) - existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_cdn_frontdoor_security_policy", id.ID()) } - profileClient := meta.(*clients.Client).Cdn.FrontDoorProfileClient - resp, err := profileClient.Get(ctx, profile.ResourceGroup, profile.ProfileName) + profileClient := meta.(*clients.Client).Cdn.FrontDoorProfilesClient + resp, err := profileClient.Get(ctx, pointer.From(profileId)) if err != nil { - return fmt.Errorf("unable to retrieve the 'sku_name' from the CDN FrontDoor Profile(Name: %q)': %+v", profile.ProfileName, err) + return fmt.Errorf("unable to retrieve the 'sku_name' from the CDN FrontDoor Profile(Name: %q)': %+v", profileId.ProfileName, err) } - if resp.Sku == nil { - return fmt.Errorf("the CDN FrontDoor Profile(Name: %q) 'sku' was nil", profile.ProfileName) + profileModel := resp.Model + + if profileModel == nil { + return fmt.Errorf("profileModel is 'nil'") } - isStandardSku := strings.HasPrefix(strings.ToLower(string(resp.Sku.Name)), "standard") + isStandardSku := true + if profileModel.Sku.Name != nil { + isStandardSku = strings.HasPrefix(strings.ToLower(string(pointer.From(profileModel.Sku.Name))), "standard") + } - params, err := cdnfrontdoorsecurityparams.ExpandCdnFrontdoorFirewallPolicyParameters(d.Get("security_policies").([]interface{}), isStandardSku) + params, err := expandCdnFrontdoorFirewallPolicyParameters(d.Get("security_policies").([]interface{}), isStandardSku) if err != nil { return fmt.Errorf("expanding 'security_policies': %+v", err) } - props := cdn.SecurityPolicy{ - SecurityPolicyProperties: &cdn.SecurityPolicyProperties{ + props := securitypolicies.SecurityPolicy{ + Properties: &securitypolicies.SecurityPolicyProperties{ Parameters: params, }, } - future, err := client.Create(ctx, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName, props) + err = client.CreateThenPoll(ctx, id, props) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceCdnFrontdoorSecurityPolicyRead(d, meta) } @@ -200,14 +204,14 @@ func resourceCdnFrontdoorSecurityPolicyRead(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorSecurityPolicyID(d.Id()) + id, err := securitypolicies.ParseSecurityPolicyID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName) + resp, err := client.Get(ctx, pointer.From(id)) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -215,53 +219,55 @@ func resourceCdnFrontdoorSecurityPolicyRead(d *pluginsdk.ResourceData, meta inte } d.Set("name", id.SecurityPolicyName) - d.Set("cdn_frontdoor_profile_id", parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID()) - - if props := resp.SecurityPolicyProperties; props != nil { - waf, ok := props.Parameters.AsSecurityPolicyWebApplicationFirewallParameters() - if !ok { - return fmt.Errorf("flattening %s: %s", id, "expected security policy web application firewall parameters") - } - - // we know it's a firewall policy at this point, - // create the objects to hold the policy data - associations := make([]interface{}, 0) + d.Set("cdn_frontdoor_profile_id", profiles.NewProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) - wafPolicyId := "" - if waf.WafPolicy != nil && waf.WafPolicy.ID != nil { - parsedId, err := parse.FrontDoorFirewallPolicyIDInsensitively(*waf.WafPolicy.ID) - if err != nil { - return fmt.Errorf("flattening `cdn_frontdoor_firewall_policy_id`: %+v", err) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if props.Parameters.SecurityPolicyPropertiesParameters().Type != securitypolicies.SecurityPolicyTypeWebApplicationFirewall { + return fmt.Errorf("'model.Properties.Parameters.Type' of %q is unexpected, want security policy 'Type' of 'WebApplicationFirewall': %s", props.Parameters.SecurityPolicyPropertiesParameters().Type, id) } - wafPolicyId = parsedId.ID() - } - if waf.Associations != nil { - for _, item := range *waf.Associations { - domain, err := cdnfrontdoorsecurityparams.FlattenSecurityPoliciesActivatedResourceReference(item.Domains) + // we know it's a firewall policy at this point, + // create the objects to hold the policy data + wafParams := props.Parameters.(securitypolicies.SecurityPolicyWebApplicationFirewallParameters) + associations := make([]interface{}, 0) + wafPolicyId := "" + + if wafParams.WafPolicy != nil && wafParams.WafPolicy.Id != nil { + parsedId, err := waf.ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively(*wafParams.WafPolicy.Id) if err != nil { - return fmt.Errorf("flattening `ActivatedResourceReference`: %+v", err) + return fmt.Errorf("flattening `cdn_frontdoor_firewall_policy_id`: %+v", err) } + wafPolicyId = parsedId.ID() + } - associations = append(associations, map[string]interface{}{ - "domain": domain, - "patterns_to_match": utils.FlattenStringSlice(item.PatternsToMatch), - }) + if wafParams.Associations != nil { + for _, item := range *wafParams.Associations { + domain, err := flattenSecurityPoliciesActivatedResourceReference(item.Domains) + if err != nil { + return fmt.Errorf("flattening `ActivatedResourceReference`: %+v", err) + } + + associations = append(associations, map[string]interface{}{ + "domain": domain, + "patterns_to_match": utils.FlattenStringSlice(item.PatternsToMatch), + }) + } } - } - securityPolicy := []interface{}{ - map[string]interface{}{ - "firewall": []interface{}{ - map[string]interface{}{ - "association": associations, - "cdn_frontdoor_firewall_policy_id": wafPolicyId, + securityPolicy := []interface{}{ + map[string]interface{}{ + "firewall": []interface{}{ + map[string]interface{}{ + "association": associations, + "cdn_frontdoor_firewall_policy_id": wafPolicyId, + }, }, }, - }, - } + } - d.Set("security_policies", securityPolicy) + d.Set("security_policies", securityPolicy) + } } return nil @@ -272,19 +278,109 @@ func resourceCdnFrontdoorSecurityPolicyDelete(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorSecurityPolicyID(d.Id()) + id, err := securitypolicies.ParseSecurityPolicyID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName) + err = client.DeleteThenPoll(ctx, pointer.From(id)) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) + return nil +} + +func expandCdnFrontdoorFirewallPolicyParameters(input []interface{}, isStandardSku bool) (*securitypolicies.SecurityPolicyWebApplicationFirewallParameters, error) { + results := securitypolicies.SecurityPolicyWebApplicationFirewallParameters{} + if len(input) == 0 { + return &results, nil } - return nil + associations := make([]securitypolicies.SecurityPolicyWebApplicationFirewallAssociation, 0) + + // pull off only the firewall policy from the security_policies list + policyType := input[0].(map[string]interface{}) + firewallPolicy := policyType["firewall"].([]interface{}) + v := firewallPolicy[0].(map[string]interface{}) + + if id := v["cdn_frontdoor_firewall_policy_id"].(string); id != "" { + results.WafPolicy = &securitypolicies.ResourceReference{ + Id: utils.String(id), + } + } + + configAssociations := v["association"].([]interface{}) + + for _, item := range configAssociations { + v := item.(map[string]interface{}) + domains := expandSecurityPoliciesActivatedResourceReference(v["domain"].([]interface{})) + + if isStandardSku { + if len(*domains) > 100 { + return &results, fmt.Errorf("the 'Standard_AzureFrontDoor' sku is only allowed to have 100 or less domains associated with the firewall policy, got %d", len(*domains)) + } + } else { + if len(*domains) > 500 { + return &results, fmt.Errorf("the 'Premium_AzureFrontDoor' sku is only allowed to have 500 or less domains associated with the firewall policy, got %d", len(*domains)) + } + } + + association := securitypolicies.SecurityPolicyWebApplicationFirewallAssociation{ + Domains: domains, + PatternsToMatch: utils.ExpandStringSlice(v["patterns_to_match"].([]interface{})), + } + + associations = append(associations, association) + } + + results.Associations = &associations + + return &results, nil +} + +func expandSecurityPoliciesActivatedResourceReference(input []interface{}) *[]securitypolicies.ActivatedResourceReference { + results := make([]securitypolicies.ActivatedResourceReference, 0) + if len(input) == 0 { + return &results + } + + for _, item := range input { + v := item.(map[string]interface{}) + + if id := v["cdn_frontdoor_domain_id"].(string); id != "" { + results = append(results, securitypolicies.ActivatedResourceReference{ + Id: pointer.To(id), + }) + } + } + + return &results +} + +func flattenSecurityPoliciesActivatedResourceReference(input *[]securitypolicies.ActivatedResourceReference) ([]interface{}, error) { + results := make([]interface{}, 0) + if input == nil { + return results, nil + } + + for _, item := range *input { + frontDoorDomainId := "" + if item.Id != nil { + if parsedFrontDoorCustomDomainId, frontDoorCustomDomainIdErr := parse.FrontDoorCustomDomainIDInsensitively(*item.Id); frontDoorCustomDomainIdErr == nil { + frontDoorDomainId = parsedFrontDoorCustomDomainId.ID() + } else if parsedFrontDoorEndpointId, frontDoorEndpointIdErr := parse.FrontDoorEndpointIDInsensitively(*item.Id); frontDoorEndpointIdErr == nil { + frontDoorDomainId = parsedFrontDoorEndpointId.ID() + } else { + return nil, fmt.Errorf("flattening `cdn_frontdoor_domain_id`: %+v; %+v", frontDoorCustomDomainIdErr, frontDoorEndpointIdErr) + } + } + + results = append(results, map[string]interface{}{ + "active": pointer.From(item.IsActive), + "cdn_frontdoor_domain_id": frontDoorDomainId, + }) + } + + return results, nil } diff --git a/internal/services/cdn/cdn_frontdoor_security_policy_resource_test.go b/internal/services/cdn/cdn_frontdoor_security_policy_resource_test.go index 92f8198889d3..722ed3b9c64a 100644 --- a/internal/services/cdn/cdn_frontdoor_security_policy_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_security_policy_resource_test.go @@ -8,10 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies" "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/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -103,15 +105,15 @@ func TestAccCdnFrontDoorSecurityPolicy_completeEndpoint(t *testing.T) { } func (r CdnFrontDoorSecurityPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.FrontDoorSecurityPolicyID(state.ID) + id, err := securitypolicies.ParseSecurityPolicyID(state.ID) if err != nil { return nil, err } client := clients.Cdn.FrontDoorSecurityPoliciesClient - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName) + resp, err := client.Get(ctx, pointer.From(id)) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %s: %+v", id, err) diff --git a/internal/services/cdn/cdn_frontdoor_shared_schema.go b/internal/services/cdn/cdn_frontdoor_shared_schema.go index a25030278b99..3b7af1c222c1 100644 --- a/internal/services/cdn/cdn_frontdoor_shared_schema.go +++ b/internal/services/cdn/cdn_frontdoor_shared_schema.go @@ -4,7 +4,8 @@ package cdn import ( - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules" + waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -14,18 +15,8 @@ func schemaCdnFrontDoorOperator() *pluginsdk.Schema { return &pluginsdk.Schema{ Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.OperatorAny), - string(cdn.OperatorEqual), - string(cdn.OperatorContains), - string(cdn.OperatorBeginsWith), - string(cdn.OperatorEndsWith), - string(cdn.OperatorLessThan), - string(cdn.OperatorLessThanOrEqual), - string(cdn.OperatorGreaterThan), - string(cdn.OperatorGreaterThanOrEqual), - string(cdn.OperatorRegEx), - }, false), + ValidateFunc: validation.StringInSlice(waf.PossibleValuesForOperator(), + false), } } @@ -33,9 +24,9 @@ func schemaCdnFrontDoorOperatorEqualOnly() *pluginsdk.Schema { return &pluginsdk.Schema{ Type: pluginsdk.TypeString, Optional: true, - Default: string(cdn.OperatorEqual), + Default: string(waf.OperatorEqual), ValidateFunc: validation.StringInSlice([]string{ - string(cdn.OperatorEqual), + string(waf.OperatorEqual), }, false), } } @@ -44,11 +35,11 @@ func schemaCdnFrontDoorOperatorRemoteAddress() *pluginsdk.Schema { return &pluginsdk.Schema{ Type: pluginsdk.TypeString, Optional: true, - Default: string(cdn.OperatorIPMatch), + Default: string(waf.OperatorIPMatch), ValidateFunc: validation.StringInSlice([]string{ - string(cdn.OperatorAny), - string(cdn.OperatorIPMatch), - string(cdn.OperatorGeoMatch), + string(waf.OperatorAny), + string(waf.OperatorIPMatch), + string(waf.OperatorGeoMatch), }, false), } } @@ -57,10 +48,10 @@ func schemaCdnFrontDoorOperatorSocketAddress() *pluginsdk.Schema { return &pluginsdk.Schema{ Type: pluginsdk.TypeString, Optional: true, - Default: string(cdn.OperatorIPMatch), + Default: string(waf.OperatorIPMatch), ValidateFunc: validation.StringInSlice([]string{ - string(cdn.OperatorAny), - string(cdn.OperatorIPMatch), + string(waf.OperatorAny), + string(waf.OperatorIPMatch), }, false), } } @@ -111,9 +102,9 @@ func schemaCdnFrontDoorSslProtocolMatchValues() *pluginsdk.Schema { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.SslProtocolTLSv1), - string(cdn.SslProtocolTLSv11), - string(cdn.SslProtocolTLSv12), + string(rules.SslProtocolTLSvOne), + string(rules.SslProtocolTLSvOnePointOne), + string(rules.SslProtocolTLSvOnePointTwo), }, false), }, } @@ -225,14 +216,8 @@ func schemaCdnFrontDoorRuleTransforms() *pluginsdk.Schema { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformRemoveNulls), - string(cdn.TransformTrim), - string(cdn.TransformUppercase), - string(cdn.TransformURLDecode), - string(cdn.TransformURLEncode), - }, false), + ValidateFunc: validation.StringInSlice(waf.PossibleValuesForTransformType(), + false), }, } } diff --git a/internal/services/cdn/client/client.go b/internal/services/cdn/client/client.go index fa144b1b2c3f..a1238124d40a 100644 --- a/internal/services/cdn/client/client.go +++ b/internal/services/cdn/client/client.go @@ -4,9 +4,14 @@ package client import ( + "fmt" + cdnSdk "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck cdnFrontDoorSdk "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies" + waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -15,19 +20,20 @@ type Client struct { FrontDoorOriginGroupsClient *cdnFrontDoorSdk.AFDOriginGroupsClient FrontDoorOriginsClient *cdnFrontDoorSdk.AFDOriginsClient FrontDoorCustomDomainsClient *cdnFrontDoorSdk.AFDCustomDomainsClient - FrontDoorSecurityPoliciesClient *cdnFrontDoorSdk.SecurityPoliciesClient + FrontDoorSecurityPoliciesClient *securitypolicies.SecurityPoliciesClient FrontDoorRoutesClient *cdnFrontDoorSdk.RoutesClient FrontDoorRulesClient *cdnFrontDoorSdk.RulesClient - FrontDoorProfileClient *cdnFrontDoorSdk.ProfilesClient + FrontDoorProfilesClient *profiles.ProfilesClient FrontDoorSecretsClient *cdnFrontDoorSdk.SecretsClient FrontDoorRuleSetsClient *cdnFrontDoorSdk.RuleSetsClient FrontDoorLegacyFirewallPoliciesClient *frontdoor.PoliciesClient + FrontDoorFirewallPoliciesClient *waf.WebApplicationFirewallPoliciesClient CustomDomainsClient *cdnSdk.CustomDomainsClient EndpointsClient *cdnSdk.EndpointsClient ProfilesClient *cdnSdk.ProfilesClient } -func NewClient(o *common.ClientOptions) *Client { +func NewClient(o *common.ClientOptions) (*Client, error) { frontDoorEndpointsClient := cdnFrontDoorSdk.NewAFDEndpointsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&frontDoorEndpointsClient.Client, o.ResourceManagerAuthorizer) @@ -40,20 +46,29 @@ func NewClient(o *common.ClientOptions) *Client { frontDoorCustomDomainsClient := cdnFrontDoorSdk.NewAFDCustomDomainsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&frontDoorCustomDomainsClient.Client, o.ResourceManagerAuthorizer) - frontDoorPolicySecurityPoliciesClient := cdnFrontDoorSdk.NewSecurityPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&frontDoorPolicySecurityPoliciesClient.Client, o.ResourceManagerAuthorizer) + frontDoorSecurityPoliciesClient, err := securitypolicies.NewSecurityPoliciesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building SecurityPoliciesClient: %+v", err) + } + o.Configure(frontDoorSecurityPoliciesClient.Client, o.Authorizers.ResourceManager) frontDoorLegacyFirewallPoliciesClient := frontdoor.NewPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&frontDoorLegacyFirewallPoliciesClient.Client, o.ResourceManagerAuthorizer) + frontDoorFirewallPoliciesClient := waf.NewWebApplicationFirewallPoliciesClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&frontDoorFirewallPoliciesClient.Client, o.ResourceManagerAuthorizer) + frontDoorRoutesClient := cdnFrontDoorSdk.NewRoutesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&frontDoorRoutesClient.Client, o.ResourceManagerAuthorizer) frontDoorRulesClient := cdnFrontDoorSdk.NewRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&frontDoorRulesClient.Client, o.ResourceManagerAuthorizer) - frontDoorProfilesClient := cdnFrontDoorSdk.NewProfilesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&frontDoorProfilesClient.Client, o.ResourceManagerAuthorizer) + frontDoorProfilesClient, err := profiles.NewProfilesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building ProfilesClient: %+v", err) + } + o.Configure(frontDoorProfilesClient.Client, o.Authorizers.ResourceManager) frontDoorPolicySecretsClient := cdnFrontDoorSdk.NewSecretsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&frontDoorPolicySecretsClient.Client, o.ResourceManagerAuthorizer) @@ -70,20 +85,23 @@ func NewClient(o *common.ClientOptions) *Client { profilesClient := cdnSdk.NewProfilesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&profilesClient.Client, o.ResourceManagerAuthorizer) - return &Client{ + client := Client{ FrontDoorEndpointsClient: &frontDoorEndpointsClient, FrontDoorOriginGroupsClient: &frontDoorOriginGroupsClient, FrontDoorOriginsClient: &frontDoorOriginsClient, FrontDoorCustomDomainsClient: &frontDoorCustomDomainsClient, - FrontDoorSecurityPoliciesClient: &frontDoorPolicySecurityPoliciesClient, + FrontDoorSecurityPoliciesClient: frontDoorSecurityPoliciesClient, FrontDoorRoutesClient: &frontDoorRoutesClient, FrontDoorRulesClient: &frontDoorRulesClient, - FrontDoorProfileClient: &frontDoorProfilesClient, + FrontDoorProfilesClient: frontDoorProfilesClient, FrontDoorSecretsClient: &frontDoorPolicySecretsClient, FrontDoorRuleSetsClient: &frontDoorRuleSetsClient, FrontDoorLegacyFirewallPoliciesClient: &frontDoorLegacyFirewallPoliciesClient, + FrontDoorFirewallPoliciesClient: &frontDoorFirewallPoliciesClient, CustomDomainsClient: &customDomainsClient, EndpointsClient: &endpointsClient, ProfilesClient: &profilesClient, } + + return &client, nil } diff --git a/internal/services/cdn/frontdoorsecurityparams/cdn_frontdoor_security_params.go b/internal/services/cdn/frontdoorsecurityparams/cdn_frontdoor_security_params.go deleted file mode 100644 index 56ee0910881e..000000000000 --- a/internal/services/cdn/frontdoorsecurityparams/cdn_frontdoor_security_params.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package cdnfrontdoorsecurityparams - -import ( - "fmt" - - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" - "github.com/hashicorp/terraform-provider-azurerm/utils" -) - -type CdnFrontdoorSecurityParameters struct { - TypeName cdn.Type - ConfigName string -} - -type CdnFrontdoorSecurityMappings struct { - Firewall CdnFrontdoorSecurityParameters -} - -func ExpandCdnFrontdoorFirewallPolicyParameters(input []interface{}, isStandardSku bool) (*cdn.SecurityPolicyWebApplicationFirewallParameters, error) { - results := cdn.SecurityPolicyWebApplicationFirewallParameters{} - if len(input) == 0 { - return &results, nil - } - - associations := make([]cdn.SecurityPolicyWebApplicationFirewallAssociation, 0) - - // pull off only the firewall policy from the security_policies list - policyType := input[0].(map[string]interface{}) - firewallPolicy := policyType["firewall"].([]interface{}) - v := firewallPolicy[0].(map[string]interface{}) - - if id := v["cdn_frontdoor_firewall_policy_id"].(string); id != "" { - results.WafPolicy = &cdn.ResourceReference{ - ID: utils.String(id), - } - } - - configAssociations := v["association"].([]interface{}) - - for _, item := range configAssociations { - v := item.(map[string]interface{}) - domains := expandSecurityPoliciesActivatedResourceReference(v["domain"].([]interface{})) - - if isStandardSku { - if len(*domains) > 100 { - return &results, fmt.Errorf("the 'Standard_AzureFrontDoor' sku is only allowed to have 100 or less domains associated with the firewall policy, got %d", len(*domains)) - } - } else { - if len(*domains) > 500 { - return &results, fmt.Errorf("the 'Premium_AzureFrontDoor' sku is only allowed to have 500 or less domains associated with the firewall policy, got %d", len(*domains)) - } - } - - association := cdn.SecurityPolicyWebApplicationFirewallAssociation{ - Domains: domains, - PatternsToMatch: utils.ExpandStringSlice(v["patterns_to_match"].([]interface{})), - } - - associations = append(associations, association) - } - - results.Associations = &associations - - return &results, nil -} - -func expandSecurityPoliciesActivatedResourceReference(input []interface{}) *[]cdn.ActivatedResourceReference { - results := make([]cdn.ActivatedResourceReference, 0) - if len(input) == 0 { - return &results - } - - for _, item := range input { - v := item.(map[string]interface{}) - - if id := v["cdn_frontdoor_domain_id"].(string); id != "" { - results = append(results, cdn.ActivatedResourceReference{ - ID: utils.String(id), - }) - } - } - - return &results -} - -func FlattenSecurityPoliciesActivatedResourceReference(input *[]cdn.ActivatedResourceReference) ([]interface{}, error) { - results := make([]interface{}, 0) - if input == nil { - return results, nil - } - - for _, item := range *input { - frontDoorDomainId := "" - if item.ID != nil { - if parsedFrontDoorCustomDomainId, frontDoorCustomDomainIdErr := parse.FrontDoorCustomDomainIDInsensitively(*item.ID); frontDoorCustomDomainIdErr == nil { - frontDoorDomainId = parsedFrontDoorCustomDomainId.ID() - } else if parsedFrontDoorEndpointId, frontDoorEndpointIdErr := parse.FrontDoorEndpointIDInsensitively(*item.ID); frontDoorEndpointIdErr == nil { - frontDoorDomainId = parsedFrontDoorEndpointId.ID() - } else { - return nil, fmt.Errorf("flattening `cdn_frontdoor_domain_id`: %+v; %+v", frontDoorCustomDomainIdErr, frontDoorEndpointIdErr) - } - } - - active := false - if item.IsActive != nil { - active = *item.IsActive - } - - results = append(results, map[string]interface{}{ - "active": active, - "cdn_frontdoor_domain_id": frontDoorDomainId, - }) - } - - return results, nil -} diff --git a/internal/services/cdn/parse/front_door_route_disable_link_to_default_domain.go b/internal/services/cdn/parse/front_door_route_disable_link_to_default_domain.go deleted file mode 100644 index fb5fbe876741..000000000000 --- a/internal/services/cdn/parse/front_door_route_disable_link_to_default_domain.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "errors" - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type FrontDoorRouteDisableLinkToDefaultDomainId struct { - SubscriptionId string - ResourceGroup string - ProfileName string - AfdEndpointName string - RouteName string - DisableLinkToDefaultDomainName string -} - -func NewFrontDoorRouteDisableLinkToDefaultDomainID(subscriptionId, resourceGroup, profileName, afdEndpointName, routeName, disableLinkToDefaultDomainName string) FrontDoorRouteDisableLinkToDefaultDomainId { - return FrontDoorRouteDisableLinkToDefaultDomainId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ProfileName: profileName, - AfdEndpointName: afdEndpointName, - RouteName: routeName, - DisableLinkToDefaultDomainName: disableLinkToDefaultDomainName, - } -} - -func (id FrontDoorRouteDisableLinkToDefaultDomainId) String() string { - segments := []string{ - fmt.Sprintf("Disable Link To Default Domain Name %q", id.DisableLinkToDefaultDomainName), - fmt.Sprintf("Route Name %q", id.RouteName), - fmt.Sprintf("Afd Endpoint Name %q", id.AfdEndpointName), - fmt.Sprintf("Profile Name %q", id.ProfileName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Front Door Route Disable Link To Default Domain", segmentsStr) -} - -func (id FrontDoorRouteDisableLinkToDefaultDomainId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/afdEndpoints/%s/routes/%s/disableLinkToDefaultDomain/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ProfileName, id.AfdEndpointName, id.RouteName, id.DisableLinkToDefaultDomainName) -} - -// FrontDoorRouteDisableLinkToDefaultDomainID parses a FrontDoorRouteDisableLinkToDefaultDomain ID into an FrontDoorRouteDisableLinkToDefaultDomainId struct -func FrontDoorRouteDisableLinkToDefaultDomainID(input string) (*FrontDoorRouteDisableLinkToDefaultDomainId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an FrontDoorRouteDisableLinkToDefaultDomain ID: %+v", input, err) - } - - resourceId := FrontDoorRouteDisableLinkToDefaultDomainId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, errors.New("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, errors.New("ID was missing the 'resourceGroups' element") - } - - if resourceId.ProfileName, err = id.PopSegment("profiles"); err != nil { - return nil, err - } - if resourceId.AfdEndpointName, err = id.PopSegment("afdEndpoints"); err != nil { - return nil, err - } - if resourceId.RouteName, err = id.PopSegment("routes"); err != nil { - return nil, err - } - if resourceId.DisableLinkToDefaultDomainName, err = id.PopSegment("disableLinkToDefaultDomain"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/cdn/parse/front_door_route_disable_link_to_default_domain_test.go b/internal/services/cdn/parse/front_door_route_disable_link_to_default_domain_test.go deleted file mode 100644 index b2f81fb0aef6..000000000000 --- a/internal/services/cdn/parse/front_door_route_disable_link_to_default_domain_test.go +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = FrontDoorRouteDisableLinkToDefaultDomainId{} - -func TestFrontDoorRouteDisableLinkToDefaultDomainIDFormatter(t *testing.T) { - actual := NewFrontDoorRouteDisableLinkToDefaultDomainID("12345678-1234-9876-4563-123456789012", "resGroup1", "profile1", "endpoint1", "route1", "disableLinkToDefaultDomain1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/route1/disableLinkToDefaultDomain/disableLinkToDefaultDomain1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestFrontDoorRouteDisableLinkToDefaultDomainID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontDoorRouteDisableLinkToDefaultDomainId - }{ - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing ProfileName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/", - Error: true, - }, - - { - // missing value for ProfileName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/", - Error: true, - }, - - { - // missing AfdEndpointName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/", - Error: true, - }, - - { - // missing value for AfdEndpointName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/", - Error: true, - }, - - { - // missing RouteName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/", - Error: true, - }, - - { - // missing value for RouteName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/", - Error: true, - }, - - { - // missing DisableLinkToDefaultDomainName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/route1/", - Error: true, - }, - - { - // missing value for DisableLinkToDefaultDomainName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/route1/disableLinkToDefaultDomain/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/route1/disableLinkToDefaultDomain/disableLinkToDefaultDomain1", - Expected: &FrontDoorRouteDisableLinkToDefaultDomainId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - ProfileName: "profile1", - AfdEndpointName: "endpoint1", - RouteName: "route1", - DisableLinkToDefaultDomainName: "disableLinkToDefaultDomain1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CDN/PROFILES/PROFILE1/AFDENDPOINTS/ENDPOINT1/ROUTES/ROUTE1/DISABLELINKTODEFAULTDOMAIN/DISABLELINKTODEFAULTDOMAIN1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := FrontDoorRouteDisableLinkToDefaultDomainID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.ProfileName != v.Expected.ProfileName { - t.Fatalf("Expected %q but got %q for ProfileName", v.Expected.ProfileName, actual.ProfileName) - } - if actual.AfdEndpointName != v.Expected.AfdEndpointName { - t.Fatalf("Expected %q but got %q for AfdEndpointName", v.Expected.AfdEndpointName, actual.AfdEndpointName) - } - if actual.RouteName != v.Expected.RouteName { - t.Fatalf("Expected %q but got %q for RouteName", v.Expected.RouteName, actual.RouteName) - } - if actual.DisableLinkToDefaultDomainName != v.Expected.DisableLinkToDefaultDomainName { - t.Fatalf("Expected %q but got %q for DisableLinkToDefaultDomainName", v.Expected.DisableLinkToDefaultDomainName, actual.DisableLinkToDefaultDomainName) - } - } -} diff --git a/internal/services/cdn/resourceids.go b/internal/services/cdn/resourceids.go index 5e8b443a58cf..05081c5641be 100644 --- a/internal/services/cdn/resourceids.go +++ b/internal/services/cdn/resourceids.go @@ -22,5 +22,4 @@ package cdn //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorSecurityPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/securityPolicies/securityPolicy1 -rewrite=true // CDN FrontDoor "Associations" -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorRouteDisableLinkToDefaultDomain -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/route1/disableLinkToDefaultDomain/disableLinkToDefaultDomain1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorCustomDomainAssociation -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/associations/assoc1 diff --git a/internal/services/cdn/validate/front_door_route_disable_link_to_default_domain_id.go b/internal/services/cdn/validate/front_door_route_disable_link_to_default_domain_id.go deleted file mode 100644 index 5041b900895b..000000000000 --- a/internal/services/cdn/validate/front_door_route_disable_link_to_default_domain_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" -) - -func FrontDoorRouteDisableLinkToDefaultDomainID(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 := parse.FrontDoorRouteDisableLinkToDefaultDomainID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/cdn/validate/front_door_route_disable_link_to_default_domain_id_test.go b/internal/services/cdn/validate/front_door_route_disable_link_to_default_domain_id_test.go deleted file mode 100644 index 34198ede0a79..000000000000 --- a/internal/services/cdn/validate/front_door_route_disable_link_to_default_domain_id_test.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestFrontDoorRouteDisableLinkToDefaultDomainID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing ProfileName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/", - Valid: false, - }, - - { - // missing value for ProfileName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/", - Valid: false, - }, - - { - // missing AfdEndpointName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/", - Valid: false, - }, - - { - // missing value for AfdEndpointName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/", - Valid: false, - }, - - { - // missing RouteName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/", - Valid: false, - }, - - { - // missing value for RouteName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/", - Valid: false, - }, - - { - // missing DisableLinkToDefaultDomainName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/route1/", - Valid: false, - }, - - { - // missing value for DisableLinkToDefaultDomainName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/route1/disableLinkToDefaultDomain/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1/routes/route1/disableLinkToDefaultDomain/disableLinkToDefaultDomain1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CDN/PROFILES/PROFILE1/AFDENDPOINTS/ENDPOINT1/ROUTES/ROUTE1/DISABLELINKTODEFAULTDOMAIN/DISABLELINKTODEFAULTDOMAIN1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := FrontDoorRouteDisableLinkToDefaultDomainID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/README.md new file mode 100644 index 000000000000..6e26cdff2d8d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/README.md @@ -0,0 +1,212 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles` Documentation + +The `profiles` SDK allows for interaction with Azure Resource Manager `cdn` (API Version `2024-02-01`). + +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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" +``` + + +### Client Initialization + +```go +client := profiles.NewProfilesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProfilesClient.CanMigrate` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +payload := profiles.CanMigrateParameters{ + // ... +} + + +if err := client.CanMigrateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProfilesClient.Create` + +```go +ctx := context.TODO() +id := profiles.NewProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName") + +payload := profiles.Profile{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProfilesClient.Delete` + +```go +ctx := context.TODO() +id := profiles.NewProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProfilesClient.GenerateSsoUri` + +```go +ctx := context.TODO() +id := profiles.NewProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName") + +read, err := client.GenerateSsoUri(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProfilesClient.Get` + +```go +ctx := context.TODO() +id := profiles.NewProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName") + +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: `ProfilesClient.List` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// 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 +} +``` + + +### Example Usage: `ProfilesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProfilesClient.ListResourceUsage` + +```go +ctx := context.TODO() +id := profiles.NewProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName") + +// alternatively `client.ListResourceUsage(ctx, id)` can be used to do batched pagination +items, err := client.ListResourceUsageComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProfilesClient.ListSupportedOptimizationTypes` + +```go +ctx := context.TODO() +id := profiles.NewProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName") + +read, err := client.ListSupportedOptimizationTypes(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProfilesClient.Migrate` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +payload := profiles.MigrationParameters{ + // ... +} + + +if err := client.MigrateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProfilesClient.MigrationCommit` + +```go +ctx := context.TODO() +id := profiles.NewProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName") + +if err := client.MigrationCommitThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProfilesClient.Update` + +```go +ctx := context.TODO() +id := profiles.NewProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName") + +payload := profiles.ProfileUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/client.go new file mode 100644 index 000000000000..16eaef711947 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/client.go @@ -0,0 +1,26 @@ +package profiles + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfilesClient struct { + Client *resourcemanager.Client +} + +func NewProfilesClientWithBaseURI(sdkApi sdkEnv.Api) (*ProfilesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "profiles", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProfilesClient: %+v", err) + } + + return &ProfilesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/constants.go new file mode 100644 index 000000000000..7c46f402b9a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/constants.go @@ -0,0 +1,489 @@ +package profiles + +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 CanMigrateDefaultSku string + +const ( + CanMigrateDefaultSkuPremiumAzureFrontDoor CanMigrateDefaultSku = "Premium_AzureFrontDoor" + CanMigrateDefaultSkuStandardAzureFrontDoor CanMigrateDefaultSku = "Standard_AzureFrontDoor" +) + +func PossibleValuesForCanMigrateDefaultSku() []string { + return []string{ + string(CanMigrateDefaultSkuPremiumAzureFrontDoor), + string(CanMigrateDefaultSkuStandardAzureFrontDoor), + } +} + +func (s *CanMigrateDefaultSku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCanMigrateDefaultSku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCanMigrateDefaultSku(input string) (*CanMigrateDefaultSku, error) { + vals := map[string]CanMigrateDefaultSku{ + "premium_azurefrontdoor": CanMigrateDefaultSkuPremiumAzureFrontDoor, + "standard_azurefrontdoor": CanMigrateDefaultSkuStandardAzureFrontDoor, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CanMigrateDefaultSku(input) + return &out, nil +} + +type OptimizationType string + +const ( + OptimizationTypeDynamicSiteAcceleration OptimizationType = "DynamicSiteAcceleration" + OptimizationTypeGeneralMediaStreaming OptimizationType = "GeneralMediaStreaming" + OptimizationTypeGeneralWebDelivery OptimizationType = "GeneralWebDelivery" + OptimizationTypeLargeFileDownload OptimizationType = "LargeFileDownload" + OptimizationTypeVideoOnDemandMediaStreaming OptimizationType = "VideoOnDemandMediaStreaming" +) + +func PossibleValuesForOptimizationType() []string { + return []string{ + string(OptimizationTypeDynamicSiteAcceleration), + string(OptimizationTypeGeneralMediaStreaming), + string(OptimizationTypeGeneralWebDelivery), + string(OptimizationTypeLargeFileDownload), + string(OptimizationTypeVideoOnDemandMediaStreaming), + } +} + +func (s *OptimizationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOptimizationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOptimizationType(input string) (*OptimizationType, error) { + vals := map[string]OptimizationType{ + "dynamicsiteacceleration": OptimizationTypeDynamicSiteAcceleration, + "generalmediastreaming": OptimizationTypeGeneralMediaStreaming, + "generalwebdelivery": OptimizationTypeGeneralWebDelivery, + "largefiledownload": OptimizationTypeLargeFileDownload, + "videoondemandmediastreaming": OptimizationTypeVideoOnDemandMediaStreaming, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OptimizationType(input) + return &out, nil +} + +type ProfileProvisioningState string + +const ( + ProfileProvisioningStateCreating ProfileProvisioningState = "Creating" + ProfileProvisioningStateDeleting ProfileProvisioningState = "Deleting" + ProfileProvisioningStateFailed ProfileProvisioningState = "Failed" + ProfileProvisioningStateSucceeded ProfileProvisioningState = "Succeeded" + ProfileProvisioningStateUpdating ProfileProvisioningState = "Updating" +) + +func PossibleValuesForProfileProvisioningState() []string { + return []string{ + string(ProfileProvisioningStateCreating), + string(ProfileProvisioningStateDeleting), + string(ProfileProvisioningStateFailed), + string(ProfileProvisioningStateSucceeded), + string(ProfileProvisioningStateUpdating), + } +} + +func (s *ProfileProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProfileProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProfileProvisioningState(input string) (*ProfileProvisioningState, error) { + vals := map[string]ProfileProvisioningState{ + "creating": ProfileProvisioningStateCreating, + "deleting": ProfileProvisioningStateDeleting, + "failed": ProfileProvisioningStateFailed, + "succeeded": ProfileProvisioningStateSucceeded, + "updating": ProfileProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProfileProvisioningState(input) + return &out, nil +} + +type ProfileResourceState string + +const ( + ProfileResourceStateAbortingMigration ProfileResourceState = "AbortingMigration" + ProfileResourceStateActive ProfileResourceState = "Active" + ProfileResourceStateCommittingMigration ProfileResourceState = "CommittingMigration" + ProfileResourceStateCreating ProfileResourceState = "Creating" + ProfileResourceStateDeleting ProfileResourceState = "Deleting" + ProfileResourceStateDisabled ProfileResourceState = "Disabled" + ProfileResourceStateMigrated ProfileResourceState = "Migrated" + ProfileResourceStateMigrating ProfileResourceState = "Migrating" + ProfileResourceStatePendingMigrationCommit ProfileResourceState = "PendingMigrationCommit" +) + +func PossibleValuesForProfileResourceState() []string { + return []string{ + string(ProfileResourceStateAbortingMigration), + string(ProfileResourceStateActive), + string(ProfileResourceStateCommittingMigration), + string(ProfileResourceStateCreating), + string(ProfileResourceStateDeleting), + string(ProfileResourceStateDisabled), + string(ProfileResourceStateMigrated), + string(ProfileResourceStateMigrating), + string(ProfileResourceStatePendingMigrationCommit), + } +} + +func (s *ProfileResourceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProfileResourceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProfileResourceState(input string) (*ProfileResourceState, error) { + vals := map[string]ProfileResourceState{ + "abortingmigration": ProfileResourceStateAbortingMigration, + "active": ProfileResourceStateActive, + "committingmigration": ProfileResourceStateCommittingMigration, + "creating": ProfileResourceStateCreating, + "deleting": ProfileResourceStateDeleting, + "disabled": ProfileResourceStateDisabled, + "migrated": ProfileResourceStateMigrated, + "migrating": ProfileResourceStateMigrating, + "pendingmigrationcommit": ProfileResourceStatePendingMigrationCommit, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProfileResourceState(input) + return &out, nil +} + +type ProfileScrubbingState string + +const ( + ProfileScrubbingStateDisabled ProfileScrubbingState = "Disabled" + ProfileScrubbingStateEnabled ProfileScrubbingState = "Enabled" +) + +func PossibleValuesForProfileScrubbingState() []string { + return []string{ + string(ProfileScrubbingStateDisabled), + string(ProfileScrubbingStateEnabled), + } +} + +func (s *ProfileScrubbingState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProfileScrubbingState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProfileScrubbingState(input string) (*ProfileScrubbingState, error) { + vals := map[string]ProfileScrubbingState{ + "disabled": ProfileScrubbingStateDisabled, + "enabled": ProfileScrubbingStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProfileScrubbingState(input) + return &out, nil +} + +type ResourceUsageUnit string + +const ( + ResourceUsageUnitCount ResourceUsageUnit = "count" +) + +func PossibleValuesForResourceUsageUnit() []string { + return []string{ + string(ResourceUsageUnitCount), + } +} + +func (s *ResourceUsageUnit) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceUsageUnit(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceUsageUnit(input string) (*ResourceUsageUnit, error) { + vals := map[string]ResourceUsageUnit{ + "count": ResourceUsageUnitCount, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceUsageUnit(input) + return &out, nil +} + +type ScrubbingRuleEntryMatchOperator string + +const ( + ScrubbingRuleEntryMatchOperatorEqualsAny ScrubbingRuleEntryMatchOperator = "EqualsAny" +) + +func PossibleValuesForScrubbingRuleEntryMatchOperator() []string { + return []string{ + string(ScrubbingRuleEntryMatchOperatorEqualsAny), + } +} + +func (s *ScrubbingRuleEntryMatchOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScrubbingRuleEntryMatchOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseScrubbingRuleEntryMatchOperator(input string) (*ScrubbingRuleEntryMatchOperator, error) { + vals := map[string]ScrubbingRuleEntryMatchOperator{ + "equalsany": ScrubbingRuleEntryMatchOperatorEqualsAny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScrubbingRuleEntryMatchOperator(input) + return &out, nil +} + +type ScrubbingRuleEntryMatchVariable string + +const ( + ScrubbingRuleEntryMatchVariableQueryStringArgNames ScrubbingRuleEntryMatchVariable = "QueryStringArgNames" + ScrubbingRuleEntryMatchVariableRequestIPAddress ScrubbingRuleEntryMatchVariable = "RequestIPAddress" + ScrubbingRuleEntryMatchVariableRequestUri ScrubbingRuleEntryMatchVariable = "RequestUri" +) + +func PossibleValuesForScrubbingRuleEntryMatchVariable() []string { + return []string{ + string(ScrubbingRuleEntryMatchVariableQueryStringArgNames), + string(ScrubbingRuleEntryMatchVariableRequestIPAddress), + string(ScrubbingRuleEntryMatchVariableRequestUri), + } +} + +func (s *ScrubbingRuleEntryMatchVariable) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScrubbingRuleEntryMatchVariable(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseScrubbingRuleEntryMatchVariable(input string) (*ScrubbingRuleEntryMatchVariable, error) { + vals := map[string]ScrubbingRuleEntryMatchVariable{ + "querystringargnames": ScrubbingRuleEntryMatchVariableQueryStringArgNames, + "requestipaddress": ScrubbingRuleEntryMatchVariableRequestIPAddress, + "requesturi": ScrubbingRuleEntryMatchVariableRequestUri, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScrubbingRuleEntryMatchVariable(input) + return &out, nil +} + +type ScrubbingRuleEntryState string + +const ( + ScrubbingRuleEntryStateDisabled ScrubbingRuleEntryState = "Disabled" + ScrubbingRuleEntryStateEnabled ScrubbingRuleEntryState = "Enabled" +) + +func PossibleValuesForScrubbingRuleEntryState() []string { + return []string{ + string(ScrubbingRuleEntryStateDisabled), + string(ScrubbingRuleEntryStateEnabled), + } +} + +func (s *ScrubbingRuleEntryState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScrubbingRuleEntryState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseScrubbingRuleEntryState(input string) (*ScrubbingRuleEntryState, error) { + vals := map[string]ScrubbingRuleEntryState{ + "disabled": ScrubbingRuleEntryStateDisabled, + "enabled": ScrubbingRuleEntryStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScrubbingRuleEntryState(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameCustomVerizon SkuName = "Custom_Verizon" + SkuNamePremiumAzureFrontDoor SkuName = "Premium_AzureFrontDoor" + SkuNamePremiumVerizon SkuName = "Premium_Verizon" + SkuNameStandardAkamai SkuName = "Standard_Akamai" + SkuNameStandardAvgBandWidthChinaCdn SkuName = "Standard_AvgBandWidth_ChinaCdn" + SkuNameStandardAzureFrontDoor SkuName = "Standard_AzureFrontDoor" + SkuNameStandardChinaCdn SkuName = "Standard_ChinaCdn" + SkuNameStandardMicrosoft SkuName = "Standard_Microsoft" + SkuNameStandardNineFiveFiveBandWidthChinaCdn SkuName = "Standard_955BandWidth_ChinaCdn" + SkuNameStandardPlusAvgBandWidthChinaCdn SkuName = "StandardPlus_AvgBandWidth_ChinaCdn" + SkuNameStandardPlusChinaCdn SkuName = "StandardPlus_ChinaCdn" + SkuNameStandardPlusNineFiveFiveBandWidthChinaCdn SkuName = "StandardPlus_955BandWidth_ChinaCdn" + SkuNameStandardVerizon SkuName = "Standard_Verizon" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameCustomVerizon), + string(SkuNamePremiumAzureFrontDoor), + string(SkuNamePremiumVerizon), + string(SkuNameStandardAkamai), + string(SkuNameStandardAvgBandWidthChinaCdn), + string(SkuNameStandardAzureFrontDoor), + string(SkuNameStandardChinaCdn), + string(SkuNameStandardMicrosoft), + string(SkuNameStandardNineFiveFiveBandWidthChinaCdn), + string(SkuNameStandardPlusAvgBandWidthChinaCdn), + string(SkuNameStandardPlusChinaCdn), + string(SkuNameStandardPlusNineFiveFiveBandWidthChinaCdn), + string(SkuNameStandardVerizon), + } +} + +func (s *SkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "custom_verizon": SkuNameCustomVerizon, + "premium_azurefrontdoor": SkuNamePremiumAzureFrontDoor, + "premium_verizon": SkuNamePremiumVerizon, + "standard_akamai": SkuNameStandardAkamai, + "standard_avgbandwidth_chinacdn": SkuNameStandardAvgBandWidthChinaCdn, + "standard_azurefrontdoor": SkuNameStandardAzureFrontDoor, + "standard_chinacdn": SkuNameStandardChinaCdn, + "standard_microsoft": SkuNameStandardMicrosoft, + "standard_955bandwidth_chinacdn": SkuNameStandardNineFiveFiveBandWidthChinaCdn, + "standardplus_avgbandwidth_chinacdn": SkuNameStandardPlusAvgBandWidthChinaCdn, + "standardplus_chinacdn": SkuNameStandardPlusChinaCdn, + "standardplus_955bandwidth_chinacdn": SkuNameStandardPlusNineFiveFiveBandWidthChinaCdn, + "standard_verizon": SkuNameStandardVerizon, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/id_profile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/id_profile.go new file mode 100644 index 000000000000..065332c709d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/id_profile.go @@ -0,0 +1,130 @@ +package profiles + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ProfileId{}) +} + +var _ resourceids.ResourceId = &ProfileId{} + +// ProfileId is a struct representing the Resource ID for a Profile +type ProfileId struct { + SubscriptionId string + ResourceGroupName string + ProfileName string +} + +// NewProfileID returns a new ProfileId struct +func NewProfileID(subscriptionId string, resourceGroupName string, profileName string) ProfileId { + return ProfileId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProfileName: profileName, + } +} + +// ParseProfileID parses 'input' into a ProfileId +func ParseProfileID(input string) (*ProfileId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProfileId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProfileId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProfileIDInsensitively parses 'input' case-insensitively into a ProfileId +// note: this method should only be used for API response data and not user input +func ParseProfileIDInsensitively(input string) (*ProfileId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProfileId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProfileId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ProfileName, ok = input.Parsed["profileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "profileName", input) + } + + return nil +} + +// ValidateProfileID checks that 'input' can be parsed as a Profile ID +func ValidateProfileID(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 := ParseProfileID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Profile ID +func (id ProfileId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Profile ID +func (id ProfileId) 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("staticMicrosoftCdn", "Microsoft.Cdn", "Microsoft.Cdn"), + resourceids.StaticSegment("staticProfiles", "profiles", "profiles"), + resourceids.UserSpecifiedSegment("profileName", "profileName"), + } +} + +// String returns a human-readable description of this Profile ID +func (id ProfileId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Profile Name: %q", id.ProfileName), + } + return fmt.Sprintf("Profile (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_canmigrate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_canmigrate.go new file mode 100644 index 000000000000..a202ece80657 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_canmigrate.go @@ -0,0 +1,76 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CanMigrateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CanMigrateResult +} + +// CanMigrate ... +func (c ProfilesClient) CanMigrate(ctx context.Context, id commonids.ResourceGroupId, input CanMigrateParameters) (result CanMigrateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.Cdn/canMigrate", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CanMigrateThenPoll performs CanMigrate then polls until it's completed +func (c ProfilesClient) CanMigrateThenPoll(ctx context.Context, id commonids.ResourceGroupId, input CanMigrateParameters) error { + result, err := c.CanMigrate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CanMigrate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CanMigrate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_create.go new file mode 100644 index 000000000000..fdde9d737ec6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_create.go @@ -0,0 +1,76 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Profile +} + +// Create ... +func (c ProfilesClient) Create(ctx context.Context, id ProfileId, input Profile) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ProfilesClient) CreateThenPoll(ctx context.Context, id ProfileId, input Profile) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_delete.go new file mode 100644 index 000000000000..8d46fe3a4ffc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_delete.go @@ -0,0 +1,71 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ProfilesClient) Delete(ctx context.Context, id ProfileId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ProfilesClient) DeleteThenPoll(ctx context.Context, id ProfileId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_generatessouri.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_generatessouri.go new file mode 100644 index 000000000000..763f54f9cc51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_generatessouri.go @@ -0,0 +1,54 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateSsoUriOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SsoUri +} + +// GenerateSsoUri ... +func (c ProfilesClient) GenerateSsoUri(ctx context.Context, id ProfileId) (result GenerateSsoUriOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateSsoUri", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SsoUri + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_get.go new file mode 100644 index 000000000000..d26affa96a58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_get.go @@ -0,0 +1,53 @@ +package profiles + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *Profile +} + +// Get ... +func (c ProfilesClient) Get(ctx context.Context, id ProfileId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Profile + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_list.go new file mode 100644 index 000000000000..846a4708f4b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_list.go @@ -0,0 +1,106 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *[]Profile +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Profile +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c ProfilesClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Cdn/profiles", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Profile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ProfilesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ProfileOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProfilesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ProfileOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Profile, 0) + + resp, err := c.List(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_listbyresourcegroup.go new file mode 100644 index 000000000000..d97ea342aa62 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Profile +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Profile +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c ProfilesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Cdn/profiles", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Profile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ProfilesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ProfileOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProfilesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ProfileOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Profile, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_listresourceusage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_listresourceusage.go new file mode 100644 index 000000000000..1f51a1643fd5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_listresourceusage.go @@ -0,0 +1,105 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListResourceUsageOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ResourceUsage +} + +type ListResourceUsageCompleteResult struct { + LatestHttpResponse *http.Response + Items []ResourceUsage +} + +type ListResourceUsageCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListResourceUsageCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListResourceUsage ... +func (c ProfilesClient) ListResourceUsage(ctx context.Context, id ProfileId) (result ListResourceUsageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Pager: &ListResourceUsageCustomPager{}, + Path: fmt.Sprintf("%s/checkResourceUsage", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ResourceUsage `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListResourceUsageComplete retrieves all the results into a single object +func (c ProfilesClient) ListResourceUsageComplete(ctx context.Context, id ProfileId) (ListResourceUsageCompleteResult, error) { + return c.ListResourceUsageCompleteMatchingPredicate(ctx, id, ResourceUsageOperationPredicate{}) +} + +// ListResourceUsageCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProfilesClient) ListResourceUsageCompleteMatchingPredicate(ctx context.Context, id ProfileId, predicate ResourceUsageOperationPredicate) (result ListResourceUsageCompleteResult, err error) { + items := make([]ResourceUsage, 0) + + resp, err := c.ListResourceUsage(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListResourceUsageCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_listsupportedoptimizationtypes.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_listsupportedoptimizationtypes.go new file mode 100644 index 000000000000..e743655689a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_listsupportedoptimizationtypes.go @@ -0,0 +1,54 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSupportedOptimizationTypesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SupportedOptimizationTypesListResult +} + +// ListSupportedOptimizationTypes ... +func (c ProfilesClient) ListSupportedOptimizationTypes(ctx context.Context, id ProfileId) (result ListSupportedOptimizationTypesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getSupportedOptimizationTypes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SupportedOptimizationTypesListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_migrate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_migrate.go new file mode 100644 index 000000000000..d39d3404201c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_migrate.go @@ -0,0 +1,76 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *MigrateResult +} + +// Migrate ... +func (c ProfilesClient) Migrate(ctx context.Context, id commonids.ResourceGroupId, input MigrationParameters) (result MigrateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.Cdn/migrate", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// MigrateThenPoll performs Migrate then polls until it's completed +func (c ProfilesClient) MigrateThenPoll(ctx context.Context, id commonids.ResourceGroupId, input MigrationParameters) error { + result, err := c.Migrate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Migrate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Migrate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_migrationcommit.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_migrationcommit.go new file mode 100644 index 000000000000..eb5e0a88a270 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_migrationcommit.go @@ -0,0 +1,70 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationCommitOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// MigrationCommit ... +func (c ProfilesClient) MigrationCommit(ctx context.Context, id ProfileId) (result MigrationCommitOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/migrationCommit", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// MigrationCommitThenPoll performs MigrationCommit then polls until it's completed +func (c ProfilesClient) MigrationCommitThenPoll(ctx context.Context, id ProfileId) error { + result, err := c.MigrationCommit(ctx, id) + if err != nil { + return fmt.Errorf("performing MigrationCommit: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after MigrationCommit: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_update.go new file mode 100644 index 000000000000..5694b5666a69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/method_update.go @@ -0,0 +1,75 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Profile +} + +// Update ... +func (c ProfilesClient) Update(ctx context.Context, id ProfileId, input ProfileUpdateParameters) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ProfilesClient) UpdateThenPoll(ctx context.Context, id ProfileId, input ProfileUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_canmigrateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_canmigrateparameters.go new file mode 100644 index 000000000000..cba030af8d7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_canmigrateparameters.go @@ -0,0 +1,8 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CanMigrateParameters struct { + ClassicResourceReference ResourceReference `json:"classicResourceReference"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_canmigrateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_canmigrateproperties.go new file mode 100644 index 000000000000..8a79f4648c1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_canmigrateproperties.go @@ -0,0 +1,10 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CanMigrateProperties struct { + CanMigrate *bool `json:"canMigrate,omitempty"` + DefaultSku *CanMigrateDefaultSku `json:"defaultSku,omitempty"` + Errors *[]MigrationErrorType `json:"errors,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_canmigrateresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_canmigrateresult.go new file mode 100644 index 000000000000..500699ff7756 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_canmigrateresult.go @@ -0,0 +1,10 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CanMigrateResult struct { + Id *string `json:"id,omitempty"` + Properties *CanMigrateProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrateresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrateresult.go new file mode 100644 index 000000000000..c53f7a73fc5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrateresult.go @@ -0,0 +1,10 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrateResult struct { + Id *string `json:"id,omitempty"` + Properties *MigrateResultProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrateresultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrateresultproperties.go new file mode 100644 index 000000000000..ad533db013d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrateresultproperties.go @@ -0,0 +1,8 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrateResultProperties struct { + MigratedProfileResourceId *ResourceReference `json:"migratedProfileResourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrationerrortype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrationerrortype.go new file mode 100644 index 000000000000..6155279d9c10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrationerrortype.go @@ -0,0 +1,11 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationErrorType struct { + Code *string `json:"code,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + NextSteps *string `json:"nextSteps,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrationparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrationparameters.go new file mode 100644 index 000000000000..37a14cc634b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrationparameters.go @@ -0,0 +1,11 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationParameters struct { + ClassicResourceReference ResourceReference `json:"classicResourceReference"` + MigrationWebApplicationFirewallMappings *[]MigrationWebApplicationFirewallMapping `json:"migrationWebApplicationFirewallMappings,omitempty"` + ProfileName string `json:"profileName"` + Sku Sku `json:"sku"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrationwebapplicationfirewallmapping.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrationwebapplicationfirewallmapping.go new file mode 100644 index 000000000000..342be3055889 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_migrationwebapplicationfirewallmapping.go @@ -0,0 +1,9 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationWebApplicationFirewallMapping struct { + MigratedFrom *ResourceReference `json:"migratedFrom,omitempty"` + MigratedTo *ResourceReference `json:"migratedTo,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profile.go new file mode 100644 index 000000000000..2568ad9b1302 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profile.go @@ -0,0 +1,22 @@ +package profiles + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "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 Profile struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ProfileProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profilelogscrubbing.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profilelogscrubbing.go new file mode 100644 index 000000000000..f897715e8c2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profilelogscrubbing.go @@ -0,0 +1,9 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfileLogScrubbing struct { + ScrubbingRules *[]ProfileScrubbingRules `json:"scrubbingRules,omitempty"` + State *ProfileScrubbingState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profileproperties.go new file mode 100644 index 000000000000..6c9e4d175b42 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profileproperties.go @@ -0,0 +1,13 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfileProperties struct { + ExtendedProperties *map[string]string `json:"extendedProperties,omitempty"` + FrontDoorId *string `json:"frontDoorId,omitempty"` + LogScrubbing *ProfileLogScrubbing `json:"logScrubbing,omitempty"` + OriginResponseTimeoutSeconds *int64 `json:"originResponseTimeoutSeconds,omitempty"` + ProvisioningState *ProfileProvisioningState `json:"provisioningState,omitempty"` + ResourceState *ProfileResourceState `json:"resourceState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profilepropertiesupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profilepropertiesupdateparameters.go new file mode 100644 index 000000000000..01d3dc5ad0e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profilepropertiesupdateparameters.go @@ -0,0 +1,9 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfilePropertiesUpdateParameters struct { + LogScrubbing *ProfileLogScrubbing `json:"logScrubbing,omitempty"` + OriginResponseTimeoutSeconds *int64 `json:"originResponseTimeoutSeconds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profilescrubbingrules.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profilescrubbingrules.go new file mode 100644 index 000000000000..9ed138086f8b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profilescrubbingrules.go @@ -0,0 +1,11 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfileScrubbingRules struct { + MatchVariable ScrubbingRuleEntryMatchVariable `json:"matchVariable"` + Selector *string `json:"selector,omitempty"` + SelectorMatchOperator ScrubbingRuleEntryMatchOperator `json:"selectorMatchOperator"` + State *ScrubbingRuleEntryState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profileupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profileupdateparameters.go new file mode 100644 index 000000000000..01c4b9665364 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_profileupdateparameters.go @@ -0,0 +1,14 @@ +package profiles + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfileUpdateParameters struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Properties *ProfilePropertiesUpdateParameters `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_resourcereference.go new file mode 100644 index 000000000000..3e5faa3a3d77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_resourcereference.go @@ -0,0 +1,8 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_resourceusage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_resourceusage.go new file mode 100644 index 000000000000..f56db4430e27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_resourceusage.go @@ -0,0 +1,11 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceUsage struct { + CurrentValue *int64 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Unit *ResourceUsageUnit `json:"unit,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_sku.go new file mode 100644 index 000000000000..a70d546bfd69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_sku.go @@ -0,0 +1,8 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name *SkuName `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_ssouri.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_ssouri.go new file mode 100644 index 000000000000..ae93b0584f8a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_ssouri.go @@ -0,0 +1,8 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SsoUri struct { + SsoUriValue *string `json:"ssoUriValue,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_supportedoptimizationtypeslistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_supportedoptimizationtypeslistresult.go new file mode 100644 index 000000000000..1242943b3db6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/model_supportedoptimizationtypeslistresult.go @@ -0,0 +1,8 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SupportedOptimizationTypesListResult struct { + SupportedOptimizationTypes *[]OptimizationType `json:"supportedOptimizationTypes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/predicates.go new file mode 100644 index 000000000000..f48c2803370e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/predicates.go @@ -0,0 +1,60 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfileOperationPredicate struct { + Id *string + Kind *string + Location *string + Name *string + Type *string +} + +func (p ProfileOperationPredicate) Matches(input Profile) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil || *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + 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 +} + +type ResourceUsageOperationPredicate struct { + CurrentValue *int64 + Limit *int64 + ResourceType *string +} + +func (p ResourceUsageOperationPredicate) Matches(input ResourceUsage) bool { + + if p.CurrentValue != nil && (input.CurrentValue == nil || *p.CurrentValue != *input.CurrentValue) { + return false + } + + if p.Limit != nil && (input.Limit == nil || *p.Limit != *input.Limit) { + return false + } + + if p.ResourceType != nil && (input.ResourceType == nil || *p.ResourceType != *input.ResourceType) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/version.go new file mode 100644 index 000000000000..3a0dc8d5b917 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles/version.go @@ -0,0 +1,10 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-02-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/profiles/2024-02-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/README.md new file mode 100644 index 000000000000..f1231501df96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies` Documentation + +The `securitypolicies` SDK allows for interaction with Azure Resource Manager `cdn` (API Version `2024-02-01`). + +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/cdn/2024-02-01/securitypolicies" +``` + + +### Client Initialization + +```go +client := securitypolicies.NewSecurityPoliciesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SecurityPoliciesClient.Create` + +```go +ctx := context.TODO() +id := securitypolicies.NewSecurityPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "securityPolicyName") + +payload := securitypolicies.SecurityPolicy{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SecurityPoliciesClient.Delete` + +```go +ctx := context.TODO() +id := securitypolicies.NewSecurityPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "securityPolicyName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SecurityPoliciesClient.Get` + +```go +ctx := context.TODO() +id := securitypolicies.NewSecurityPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "securityPolicyName") + +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: `SecurityPoliciesClient.ListByProfile` + +```go +ctx := context.TODO() +id := securitypolicies.NewProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName") + +// alternatively `client.ListByProfile(ctx, id)` can be used to do batched pagination +items, err := client.ListByProfileComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SecurityPoliciesClient.Patch` + +```go +ctx := context.TODO() +id := securitypolicies.NewSecurityPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "securityPolicyName") + +payload := securitypolicies.SecurityPolicyUpdateParameters{ + // ... +} + + +if err := client.PatchThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/client.go new file mode 100644 index 000000000000..55cc8c476cb4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/client.go @@ -0,0 +1,26 @@ +package securitypolicies + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPoliciesClient struct { + Client *resourcemanager.Client +} + +func NewSecurityPoliciesClientWithBaseURI(sdkApi sdkEnv.Api) (*SecurityPoliciesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "securitypolicies", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SecurityPoliciesClient: %+v", err) + } + + return &SecurityPoliciesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/constants.go new file mode 100644 index 000000000000..7354c2cb3267 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/constants.go @@ -0,0 +1,145 @@ +package securitypolicies + +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 AfdProvisioningState string + +const ( + AfdProvisioningStateCreating AfdProvisioningState = "Creating" + AfdProvisioningStateDeleting AfdProvisioningState = "Deleting" + AfdProvisioningStateFailed AfdProvisioningState = "Failed" + AfdProvisioningStateSucceeded AfdProvisioningState = "Succeeded" + AfdProvisioningStateUpdating AfdProvisioningState = "Updating" +) + +func PossibleValuesForAfdProvisioningState() []string { + return []string{ + string(AfdProvisioningStateCreating), + string(AfdProvisioningStateDeleting), + string(AfdProvisioningStateFailed), + string(AfdProvisioningStateSucceeded), + string(AfdProvisioningStateUpdating), + } +} + +func (s *AfdProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAfdProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAfdProvisioningState(input string) (*AfdProvisioningState, error) { + vals := map[string]AfdProvisioningState{ + "creating": AfdProvisioningStateCreating, + "deleting": AfdProvisioningStateDeleting, + "failed": AfdProvisioningStateFailed, + "succeeded": AfdProvisioningStateSucceeded, + "updating": AfdProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AfdProvisioningState(input) + return &out, nil +} + +type DeploymentStatus string + +const ( + DeploymentStatusFailed DeploymentStatus = "Failed" + DeploymentStatusInProgress DeploymentStatus = "InProgress" + DeploymentStatusNotStarted DeploymentStatus = "NotStarted" + DeploymentStatusSucceeded DeploymentStatus = "Succeeded" +) + +func PossibleValuesForDeploymentStatus() []string { + return []string{ + string(DeploymentStatusFailed), + string(DeploymentStatusInProgress), + string(DeploymentStatusNotStarted), + string(DeploymentStatusSucceeded), + } +} + +func (s *DeploymentStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeploymentStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeploymentStatus(input string) (*DeploymentStatus, error) { + vals := map[string]DeploymentStatus{ + "failed": DeploymentStatusFailed, + "inprogress": DeploymentStatusInProgress, + "notstarted": DeploymentStatusNotStarted, + "succeeded": DeploymentStatusSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeploymentStatus(input) + return &out, nil +} + +type SecurityPolicyType string + +const ( + SecurityPolicyTypeWebApplicationFirewall SecurityPolicyType = "WebApplicationFirewall" +) + +func PossibleValuesForSecurityPolicyType() []string { + return []string{ + string(SecurityPolicyTypeWebApplicationFirewall), + } +} + +func (s *SecurityPolicyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityPolicyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityPolicyType(input string) (*SecurityPolicyType, error) { + vals := map[string]SecurityPolicyType{ + "webapplicationfirewall": SecurityPolicyTypeWebApplicationFirewall, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityPolicyType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/id_profile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/id_profile.go new file mode 100644 index 000000000000..810760c33de4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/id_profile.go @@ -0,0 +1,130 @@ +package securitypolicies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&ProfileId{}) +} + +var _ resourceids.ResourceId = &ProfileId{} + +// ProfileId is a struct representing the Resource ID for a Profile +type ProfileId struct { + SubscriptionId string + ResourceGroupName string + ProfileName string +} + +// NewProfileID returns a new ProfileId struct +func NewProfileID(subscriptionId string, resourceGroupName string, profileName string) ProfileId { + return ProfileId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProfileName: profileName, + } +} + +// ParseProfileID parses 'input' into a ProfileId +func ParseProfileID(input string) (*ProfileId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProfileId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProfileId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProfileIDInsensitively parses 'input' case-insensitively into a ProfileId +// note: this method should only be used for API response data and not user input +func ParseProfileIDInsensitively(input string) (*ProfileId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProfileId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProfileId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ProfileName, ok = input.Parsed["profileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "profileName", input) + } + + return nil +} + +// ValidateProfileID checks that 'input' can be parsed as a Profile ID +func ValidateProfileID(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 := ParseProfileID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Profile ID +func (id ProfileId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Profile ID +func (id ProfileId) 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("staticMicrosoftCdn", "Microsoft.Cdn", "Microsoft.Cdn"), + resourceids.StaticSegment("staticProfiles", "profiles", "profiles"), + resourceids.UserSpecifiedSegment("profileName", "profileName"), + } +} + +// String returns a human-readable description of this Profile ID +func (id ProfileId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Profile Name: %q", id.ProfileName), + } + return fmt.Sprintf("Profile (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/id_securitypolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/id_securitypolicy.go new file mode 100644 index 000000000000..ae8c79ee85be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/id_securitypolicy.go @@ -0,0 +1,139 @@ +package securitypolicies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&SecurityPolicyId{}) +} + +var _ resourceids.ResourceId = &SecurityPolicyId{} + +// SecurityPolicyId is a struct representing the Resource ID for a Security Policy +type SecurityPolicyId struct { + SubscriptionId string + ResourceGroupName string + ProfileName string + SecurityPolicyName string +} + +// NewSecurityPolicyID returns a new SecurityPolicyId struct +func NewSecurityPolicyID(subscriptionId string, resourceGroupName string, profileName string, securityPolicyName string) SecurityPolicyId { + return SecurityPolicyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProfileName: profileName, + SecurityPolicyName: securityPolicyName, + } +} + +// ParseSecurityPolicyID parses 'input' into a SecurityPolicyId +func ParseSecurityPolicyID(input string) (*SecurityPolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(&SecurityPolicyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SecurityPolicyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSecurityPolicyIDInsensitively parses 'input' case-insensitively into a SecurityPolicyId +// note: this method should only be used for API response data and not user input +func ParseSecurityPolicyIDInsensitively(input string) (*SecurityPolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(&SecurityPolicyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SecurityPolicyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ProfileName, ok = input.Parsed["profileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "profileName", input) + } + + if id.SecurityPolicyName, ok = input.Parsed["securityPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityPolicyName", input) + } + + return nil +} + +// ValidateSecurityPolicyID checks that 'input' can be parsed as a Security Policy ID +func ValidateSecurityPolicyID(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 := ParseSecurityPolicyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Security Policy ID +func (id SecurityPolicyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/securityPolicies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName, id.SecurityPolicyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Security Policy ID +func (id SecurityPolicyId) 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("staticMicrosoftCdn", "Microsoft.Cdn", "Microsoft.Cdn"), + resourceids.StaticSegment("staticProfiles", "profiles", "profiles"), + resourceids.UserSpecifiedSegment("profileName", "profileName"), + resourceids.StaticSegment("staticSecurityPolicies", "securityPolicies", "securityPolicies"), + resourceids.UserSpecifiedSegment("securityPolicyName", "securityPolicyName"), + } +} + +// String returns a human-readable description of this Security Policy ID +func (id SecurityPolicyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Profile Name: %q", id.ProfileName), + fmt.Sprintf("Security Policy Name: %q", id.SecurityPolicyName), + } + return fmt.Sprintf("Security Policy (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_create.go new file mode 100644 index 000000000000..a95ec9d76fdd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_create.go @@ -0,0 +1,76 @@ +package securitypolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SecurityPolicy +} + +// Create ... +func (c SecurityPoliciesClient) Create(ctx context.Context, id SecurityPolicyId, input SecurityPolicy) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c SecurityPoliciesClient) CreateThenPoll(ctx context.Context, id SecurityPolicyId, input SecurityPolicy) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_delete.go new file mode 100644 index 000000000000..9367d103c071 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_delete.go @@ -0,0 +1,71 @@ +package securitypolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c SecurityPoliciesClient) Delete(ctx context.Context, id SecurityPolicyId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SecurityPoliciesClient) DeleteThenPoll(ctx context.Context, id SecurityPolicyId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_get.go new file mode 100644 index 000000000000..c6e380485b20 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_get.go @@ -0,0 +1,53 @@ +package securitypolicies + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *SecurityPolicy +} + +// Get ... +func (c SecurityPoliciesClient) Get(ctx context.Context, id SecurityPolicyId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SecurityPolicy + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_listbyprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_listbyprofile.go new file mode 100644 index 000000000000..322dbf96b304 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_listbyprofile.go @@ -0,0 +1,105 @@ +package securitypolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProfileOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SecurityPolicy +} + +type ListByProfileCompleteResult struct { + LatestHttpResponse *http.Response + Items []SecurityPolicy +} + +type ListByProfileCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByProfileCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByProfile ... +func (c SecurityPoliciesClient) ListByProfile(ctx context.Context, id ProfileId) (result ListByProfileOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByProfileCustomPager{}, + Path: fmt.Sprintf("%s/securityPolicies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SecurityPolicy `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByProfileComplete retrieves all the results into a single object +func (c SecurityPoliciesClient) ListByProfileComplete(ctx context.Context, id ProfileId) (ListByProfileCompleteResult, error) { + return c.ListByProfileCompleteMatchingPredicate(ctx, id, SecurityPolicyOperationPredicate{}) +} + +// ListByProfileCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SecurityPoliciesClient) ListByProfileCompleteMatchingPredicate(ctx context.Context, id ProfileId, predicate SecurityPolicyOperationPredicate) (result ListByProfileCompleteResult, err error) { + items := make([]SecurityPolicy, 0) + + resp, err := c.ListByProfile(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByProfileCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_patch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_patch.go new file mode 100644 index 000000000000..c0f9a10b2033 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/method_patch.go @@ -0,0 +1,75 @@ +package securitypolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SecurityPolicy +} + +// Patch ... +func (c SecurityPoliciesClient) Patch(ctx context.Context, id SecurityPolicyId, input SecurityPolicyUpdateParameters) (result PatchOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PatchThenPoll performs Patch then polls until it's completed +func (c SecurityPoliciesClient) PatchThenPoll(ctx context.Context, id SecurityPolicyId, input SecurityPolicyUpdateParameters) error { + result, err := c.Patch(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Patch: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Patch: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_activatedresourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_activatedresourcereference.go new file mode 100644 index 000000000000..98cdc9bedc95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_activatedresourcereference.go @@ -0,0 +1,9 @@ +package securitypolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActivatedResourceReference struct { + Id *string `json:"id,omitempty"` + IsActive *bool `json:"isActive,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_resourcereference.go new file mode 100644 index 000000000000..d51464823938 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_resourcereference.go @@ -0,0 +1,8 @@ +package securitypolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicy.go new file mode 100644 index 000000000000..798a87168df7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicy.go @@ -0,0 +1,16 @@ +package securitypolicies + +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 SecurityPolicy struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SecurityPolicyProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicyproperties.go new file mode 100644 index 000000000000..44b1c010941c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicyproperties.go @@ -0,0 +1,48 @@ +package securitypolicies + +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 SecurityPolicyProperties struct { + DeploymentStatus *DeploymentStatus `json:"deploymentStatus,omitempty"` + Parameters SecurityPolicyPropertiesParameters `json:"parameters"` + ProfileName *string `json:"profileName,omitempty"` + ProvisioningState *AfdProvisioningState `json:"provisioningState,omitempty"` +} + +var _ json.Unmarshaler = &SecurityPolicyProperties{} + +func (s *SecurityPolicyProperties) UnmarshalJSON(bytes []byte) error { + var decoded struct { + DeploymentStatus *DeploymentStatus `json:"deploymentStatus,omitempty"` + ProfileName *string `json:"profileName,omitempty"` + ProvisioningState *AfdProvisioningState `json:"provisioningState,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.DeploymentStatus = decoded.DeploymentStatus + s.ProfileName = decoded.ProfileName + s.ProvisioningState = decoded.ProvisioningState + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling SecurityPolicyProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["parameters"]; ok { + impl, err := UnmarshalSecurityPolicyPropertiesParametersImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Parameters' for 'SecurityPolicyProperties': %+v", err) + } + s.Parameters = impl + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicypropertiesparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicypropertiesparameters.go new file mode 100644 index 000000000000..05ae120b4d48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicypropertiesparameters.go @@ -0,0 +1,75 @@ +package securitypolicies + +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 SecurityPolicyPropertiesParameters interface { + SecurityPolicyPropertiesParameters() BaseSecurityPolicyPropertiesParametersImpl +} + +var _ SecurityPolicyPropertiesParameters = BaseSecurityPolicyPropertiesParametersImpl{} + +type BaseSecurityPolicyPropertiesParametersImpl struct { + Type SecurityPolicyType `json:"type"` +} + +func (s BaseSecurityPolicyPropertiesParametersImpl) SecurityPolicyPropertiesParameters() BaseSecurityPolicyPropertiesParametersImpl { + return s +} + +var _ SecurityPolicyPropertiesParameters = RawSecurityPolicyPropertiesParametersImpl{} + +// RawSecurityPolicyPropertiesParametersImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawSecurityPolicyPropertiesParametersImpl struct { + securityPolicyPropertiesParameters BaseSecurityPolicyPropertiesParametersImpl + Type string + Values map[string]interface{} +} + +func (s RawSecurityPolicyPropertiesParametersImpl) SecurityPolicyPropertiesParameters() BaseSecurityPolicyPropertiesParametersImpl { + return s.securityPolicyPropertiesParameters +} + +func UnmarshalSecurityPolicyPropertiesParametersImplementation(input []byte) (SecurityPolicyPropertiesParameters, 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 SecurityPolicyPropertiesParameters into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["type"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "WebApplicationFirewall") { + var out SecurityPolicyWebApplicationFirewallParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SecurityPolicyWebApplicationFirewallParameters: %+v", err) + } + return out, nil + } + + var parent BaseSecurityPolicyPropertiesParametersImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseSecurityPolicyPropertiesParametersImpl: %+v", err) + } + + return RawSecurityPolicyPropertiesParametersImpl{ + securityPolicyPropertiesParameters: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicyupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicyupdateparameters.go new file mode 100644 index 000000000000..c9ee59519599 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicyupdateparameters.go @@ -0,0 +1,8 @@ +package securitypolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPolicyUpdateParameters struct { + Properties *SecurityPolicyUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicyupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicyupdateproperties.go new file mode 100644 index 000000000000..231a621fb7a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicyupdateproperties.go @@ -0,0 +1,33 @@ +package securitypolicies + +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 SecurityPolicyUpdateProperties struct { + Parameters SecurityPolicyPropertiesParameters `json:"parameters"` +} + +var _ json.Unmarshaler = &SecurityPolicyUpdateProperties{} + +func (s *SecurityPolicyUpdateProperties) UnmarshalJSON(bytes []byte) error { + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling SecurityPolicyUpdateProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["parameters"]; ok { + impl, err := UnmarshalSecurityPolicyPropertiesParametersImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Parameters' for 'SecurityPolicyUpdateProperties': %+v", err) + } + s.Parameters = impl + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicywebapplicationfirewallassociation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicywebapplicationfirewallassociation.go new file mode 100644 index 000000000000..78cfbe4a2598 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicywebapplicationfirewallassociation.go @@ -0,0 +1,9 @@ +package securitypolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPolicyWebApplicationFirewallAssociation struct { + Domains *[]ActivatedResourceReference `json:"domains,omitempty"` + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicywebapplicationfirewallparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicywebapplicationfirewallparameters.go new file mode 100644 index 000000000000..26581196cc87 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/model_securitypolicywebapplicationfirewallparameters.go @@ -0,0 +1,51 @@ +package securitypolicies + +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 _ SecurityPolicyPropertiesParameters = SecurityPolicyWebApplicationFirewallParameters{} + +type SecurityPolicyWebApplicationFirewallParameters struct { + Associations *[]SecurityPolicyWebApplicationFirewallAssociation `json:"associations,omitempty"` + WafPolicy *ResourceReference `json:"wafPolicy,omitempty"` + + // Fields inherited from SecurityPolicyPropertiesParameters + + Type SecurityPolicyType `json:"type"` +} + +func (s SecurityPolicyWebApplicationFirewallParameters) SecurityPolicyPropertiesParameters() BaseSecurityPolicyPropertiesParametersImpl { + return BaseSecurityPolicyPropertiesParametersImpl{ + Type: s.Type, + } +} + +var _ json.Marshaler = SecurityPolicyWebApplicationFirewallParameters{} + +func (s SecurityPolicyWebApplicationFirewallParameters) MarshalJSON() ([]byte, error) { + type wrapper SecurityPolicyWebApplicationFirewallParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SecurityPolicyWebApplicationFirewallParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SecurityPolicyWebApplicationFirewallParameters: %+v", err) + } + + decoded["type"] = "WebApplicationFirewall" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SecurityPolicyWebApplicationFirewallParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/predicates.go new file mode 100644 index 000000000000..4b70b7eef24c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/predicates.go @@ -0,0 +1,27 @@ +package securitypolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPolicyOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SecurityPolicyOperationPredicate) Matches(input SecurityPolicy) bool { + + 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/cdn/2024-02-01/securitypolicies/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/version.go new file mode 100644 index 000000000000..16b6141b4c07 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies/version.go @@ -0,0 +1,10 @@ +package securitypolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-02-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/securitypolicies/2024-02-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/README.md new file mode 100644 index 000000000000..c3ceffd5f8d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules` Documentation + +The `rules` SDK allows for interaction with Azure Resource Manager `cdn` (API Version `2024-09-01`). + +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/cdn/2024-09-01/rules" +``` + + +### Client Initialization + +```go +client := rules.NewRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RulesClient.Create` + +```go +ctx := context.TODO() +id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName", "ruleName") + +payload := rules.Rule{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RulesClient.Delete` + +```go +ctx := context.TODO() +id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName", "ruleName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RulesClient.Get` + +```go +ctx := context.TODO() +id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName", "ruleName") + +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: `RulesClient.ListByRuleSet` + +```go +ctx := context.TODO() +id := rules.NewRuleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName") + +// alternatively `client.ListByRuleSet(ctx, id)` can be used to do batched pagination +items, err := client.ListByRuleSetComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RulesClient.Update` + +```go +ctx := context.TODO() +id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName", "ruleName") + +payload := rules.RuleUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/client.go new file mode 100644 index 000000000000..ee5a5154cef5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/client.go @@ -0,0 +1,26 @@ +package rules + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesClient struct { + Client *resourcemanager.Client +} + +func NewRulesClientWithBaseURI(sdkApi sdkEnv.Api) (*RulesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "rules", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RulesClient: %+v", err) + } + + return &RulesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/constants.go new file mode 100644 index 000000000000..6fb915180b59 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/constants.go @@ -0,0 +1,2268 @@ +package rules + +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 AfdProvisioningState string + +const ( + AfdProvisioningStateCreating AfdProvisioningState = "Creating" + AfdProvisioningStateDeleting AfdProvisioningState = "Deleting" + AfdProvisioningStateFailed AfdProvisioningState = "Failed" + AfdProvisioningStateSucceeded AfdProvisioningState = "Succeeded" + AfdProvisioningStateUpdating AfdProvisioningState = "Updating" +) + +func PossibleValuesForAfdProvisioningState() []string { + return []string{ + string(AfdProvisioningStateCreating), + string(AfdProvisioningStateDeleting), + string(AfdProvisioningStateFailed), + string(AfdProvisioningStateSucceeded), + string(AfdProvisioningStateUpdating), + } +} + +func (s *AfdProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAfdProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAfdProvisioningState(input string) (*AfdProvisioningState, error) { + vals := map[string]AfdProvisioningState{ + "creating": AfdProvisioningStateCreating, + "deleting": AfdProvisioningStateDeleting, + "failed": AfdProvisioningStateFailed, + "succeeded": AfdProvisioningStateSucceeded, + "updating": AfdProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AfdProvisioningState(input) + return &out, nil +} + +type Algorithm string + +const ( + AlgorithmSHATwoFiveSix Algorithm = "SHA256" +) + +func PossibleValuesForAlgorithm() []string { + return []string{ + string(AlgorithmSHATwoFiveSix), + } +} + +func (s *Algorithm) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlgorithm(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAlgorithm(input string) (*Algorithm, error) { + vals := map[string]Algorithm{ + "sha256": AlgorithmSHATwoFiveSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Algorithm(input) + return &out, nil +} + +type CacheBehavior string + +const ( + CacheBehaviorBypassCache CacheBehavior = "BypassCache" + CacheBehaviorOverride CacheBehavior = "Override" + CacheBehaviorSetIfMissing CacheBehavior = "SetIfMissing" +) + +func PossibleValuesForCacheBehavior() []string { + return []string{ + string(CacheBehaviorBypassCache), + string(CacheBehaviorOverride), + string(CacheBehaviorSetIfMissing), + } +} + +func (s *CacheBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCacheBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCacheBehavior(input string) (*CacheBehavior, error) { + vals := map[string]CacheBehavior{ + "bypasscache": CacheBehaviorBypassCache, + "override": CacheBehaviorOverride, + "setifmissing": CacheBehaviorSetIfMissing, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CacheBehavior(input) + return &out, nil +} + +type CacheType string + +const ( + CacheTypeAll CacheType = "All" +) + +func PossibleValuesForCacheType() []string { + return []string{ + string(CacheTypeAll), + } +} + +func (s *CacheType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCacheType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCacheType(input string) (*CacheType, error) { + vals := map[string]CacheType{ + "all": CacheTypeAll, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CacheType(input) + return &out, nil +} + +type ClientPortOperator string + +const ( + ClientPortOperatorAny ClientPortOperator = "Any" + ClientPortOperatorBeginsWith ClientPortOperator = "BeginsWith" + ClientPortOperatorContains ClientPortOperator = "Contains" + ClientPortOperatorEndsWith ClientPortOperator = "EndsWith" + ClientPortOperatorEqual ClientPortOperator = "Equal" + ClientPortOperatorGreaterThan ClientPortOperator = "GreaterThan" + ClientPortOperatorGreaterThanOrEqual ClientPortOperator = "GreaterThanOrEqual" + ClientPortOperatorLessThan ClientPortOperator = "LessThan" + ClientPortOperatorLessThanOrEqual ClientPortOperator = "LessThanOrEqual" + ClientPortOperatorRegEx ClientPortOperator = "RegEx" +) + +func PossibleValuesForClientPortOperator() []string { + return []string{ + string(ClientPortOperatorAny), + string(ClientPortOperatorBeginsWith), + string(ClientPortOperatorContains), + string(ClientPortOperatorEndsWith), + string(ClientPortOperatorEqual), + string(ClientPortOperatorGreaterThan), + string(ClientPortOperatorGreaterThanOrEqual), + string(ClientPortOperatorLessThan), + string(ClientPortOperatorLessThanOrEqual), + string(ClientPortOperatorRegEx), + } +} + +func (s *ClientPortOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClientPortOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseClientPortOperator(input string) (*ClientPortOperator, error) { + vals := map[string]ClientPortOperator{ + "any": ClientPortOperatorAny, + "beginswith": ClientPortOperatorBeginsWith, + "contains": ClientPortOperatorContains, + "endswith": ClientPortOperatorEndsWith, + "equal": ClientPortOperatorEqual, + "greaterthan": ClientPortOperatorGreaterThan, + "greaterthanorequal": ClientPortOperatorGreaterThanOrEqual, + "lessthan": ClientPortOperatorLessThan, + "lessthanorequal": ClientPortOperatorLessThanOrEqual, + "regex": ClientPortOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClientPortOperator(input) + return &out, nil +} + +type CookiesOperator string + +const ( + CookiesOperatorAny CookiesOperator = "Any" + CookiesOperatorBeginsWith CookiesOperator = "BeginsWith" + CookiesOperatorContains CookiesOperator = "Contains" + CookiesOperatorEndsWith CookiesOperator = "EndsWith" + CookiesOperatorEqual CookiesOperator = "Equal" + CookiesOperatorGreaterThan CookiesOperator = "GreaterThan" + CookiesOperatorGreaterThanOrEqual CookiesOperator = "GreaterThanOrEqual" + CookiesOperatorLessThan CookiesOperator = "LessThan" + CookiesOperatorLessThanOrEqual CookiesOperator = "LessThanOrEqual" + CookiesOperatorRegEx CookiesOperator = "RegEx" +) + +func PossibleValuesForCookiesOperator() []string { + return []string{ + string(CookiesOperatorAny), + string(CookiesOperatorBeginsWith), + string(CookiesOperatorContains), + string(CookiesOperatorEndsWith), + string(CookiesOperatorEqual), + string(CookiesOperatorGreaterThan), + string(CookiesOperatorGreaterThanOrEqual), + string(CookiesOperatorLessThan), + string(CookiesOperatorLessThanOrEqual), + string(CookiesOperatorRegEx), + } +} + +func (s *CookiesOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCookiesOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCookiesOperator(input string) (*CookiesOperator, error) { + vals := map[string]CookiesOperator{ + "any": CookiesOperatorAny, + "beginswith": CookiesOperatorBeginsWith, + "contains": CookiesOperatorContains, + "endswith": CookiesOperatorEndsWith, + "equal": CookiesOperatorEqual, + "greaterthan": CookiesOperatorGreaterThan, + "greaterthanorequal": CookiesOperatorGreaterThanOrEqual, + "lessthan": CookiesOperatorLessThan, + "lessthanorequal": CookiesOperatorLessThanOrEqual, + "regex": CookiesOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CookiesOperator(input) + return &out, nil +} + +type DeliveryRuleActionName string + +const ( + DeliveryRuleActionNameCacheExpiration DeliveryRuleActionName = "CacheExpiration" + DeliveryRuleActionNameCacheKeyQueryString DeliveryRuleActionName = "CacheKeyQueryString" + DeliveryRuleActionNameModifyRequestHeader DeliveryRuleActionName = "ModifyRequestHeader" + DeliveryRuleActionNameModifyResponseHeader DeliveryRuleActionName = "ModifyResponseHeader" + DeliveryRuleActionNameOriginGroupOverride DeliveryRuleActionName = "OriginGroupOverride" + DeliveryRuleActionNameRouteConfigurationOverride DeliveryRuleActionName = "RouteConfigurationOverride" + DeliveryRuleActionNameURLRedirect DeliveryRuleActionName = "UrlRedirect" + DeliveryRuleActionNameURLRewrite DeliveryRuleActionName = "UrlRewrite" + DeliveryRuleActionNameURLSigning DeliveryRuleActionName = "UrlSigning" +) + +func PossibleValuesForDeliveryRuleActionName() []string { + return []string{ + string(DeliveryRuleActionNameCacheExpiration), + string(DeliveryRuleActionNameCacheKeyQueryString), + string(DeliveryRuleActionNameModifyRequestHeader), + string(DeliveryRuleActionNameModifyResponseHeader), + string(DeliveryRuleActionNameOriginGroupOverride), + string(DeliveryRuleActionNameRouteConfigurationOverride), + string(DeliveryRuleActionNameURLRedirect), + string(DeliveryRuleActionNameURLRewrite), + string(DeliveryRuleActionNameURLSigning), + } +} + +func (s *DeliveryRuleActionName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeliveryRuleActionName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeliveryRuleActionName(input string) (*DeliveryRuleActionName, error) { + vals := map[string]DeliveryRuleActionName{ + "cacheexpiration": DeliveryRuleActionNameCacheExpiration, + "cachekeyquerystring": DeliveryRuleActionNameCacheKeyQueryString, + "modifyrequestheader": DeliveryRuleActionNameModifyRequestHeader, + "modifyresponseheader": DeliveryRuleActionNameModifyResponseHeader, + "origingroupoverride": DeliveryRuleActionNameOriginGroupOverride, + "routeconfigurationoverride": DeliveryRuleActionNameRouteConfigurationOverride, + "urlredirect": DeliveryRuleActionNameURLRedirect, + "urlrewrite": DeliveryRuleActionNameURLRewrite, + "urlsigning": DeliveryRuleActionNameURLSigning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeliveryRuleActionName(input) + return &out, nil +} + +type DeliveryRuleActionParametersType string + +const ( + DeliveryRuleActionParametersTypeDeliveryRuleCacheExpirationActionParameters DeliveryRuleActionParametersType = "DeliveryRuleCacheExpirationActionParameters" + DeliveryRuleActionParametersTypeDeliveryRuleCacheKeyQueryStringBehaviorActionParameters DeliveryRuleActionParametersType = "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" + DeliveryRuleActionParametersTypeDeliveryRuleHeaderActionParameters DeliveryRuleActionParametersType = "DeliveryRuleHeaderActionParameters" + DeliveryRuleActionParametersTypeDeliveryRuleOriginGroupOverrideActionParameters DeliveryRuleActionParametersType = "DeliveryRuleOriginGroupOverrideActionParameters" + DeliveryRuleActionParametersTypeDeliveryRuleRouteConfigurationOverrideActionParameters DeliveryRuleActionParametersType = "DeliveryRuleRouteConfigurationOverrideActionParameters" + DeliveryRuleActionParametersTypeDeliveryRuleURLRedirectActionParameters DeliveryRuleActionParametersType = "DeliveryRuleUrlRedirectActionParameters" + DeliveryRuleActionParametersTypeDeliveryRuleURLRewriteActionParameters DeliveryRuleActionParametersType = "DeliveryRuleUrlRewriteActionParameters" + DeliveryRuleActionParametersTypeDeliveryRuleURLSigningActionParameters DeliveryRuleActionParametersType = "DeliveryRuleUrlSigningActionParameters" +) + +func PossibleValuesForDeliveryRuleActionParametersType() []string { + return []string{ + string(DeliveryRuleActionParametersTypeDeliveryRuleCacheExpirationActionParameters), + string(DeliveryRuleActionParametersTypeDeliveryRuleCacheKeyQueryStringBehaviorActionParameters), + string(DeliveryRuleActionParametersTypeDeliveryRuleHeaderActionParameters), + string(DeliveryRuleActionParametersTypeDeliveryRuleOriginGroupOverrideActionParameters), + string(DeliveryRuleActionParametersTypeDeliveryRuleRouteConfigurationOverrideActionParameters), + string(DeliveryRuleActionParametersTypeDeliveryRuleURLRedirectActionParameters), + string(DeliveryRuleActionParametersTypeDeliveryRuleURLRewriteActionParameters), + string(DeliveryRuleActionParametersTypeDeliveryRuleURLSigningActionParameters), + } +} + +func (s *DeliveryRuleActionParametersType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeliveryRuleActionParametersType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeliveryRuleActionParametersType(input string) (*DeliveryRuleActionParametersType, error) { + vals := map[string]DeliveryRuleActionParametersType{ + "deliveryrulecacheexpirationactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleCacheExpirationActionParameters, + "deliveryrulecachekeyquerystringbehavioractionparameters": DeliveryRuleActionParametersTypeDeliveryRuleCacheKeyQueryStringBehaviorActionParameters, + "deliveryruleheaderactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleHeaderActionParameters, + "deliveryruleorigingroupoverrideactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleOriginGroupOverrideActionParameters, + "deliveryrulerouteconfigurationoverrideactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleRouteConfigurationOverrideActionParameters, + "deliveryruleurlredirectactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleURLRedirectActionParameters, + "deliveryruleurlrewriteactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleURLRewriteActionParameters, + "deliveryruleurlsigningactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleURLSigningActionParameters, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeliveryRuleActionParametersType(input) + return &out, nil +} + +type DeliveryRuleConditionParametersType string + +const ( + DeliveryRuleConditionParametersTypeDeliveryRuleClientPortConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleClientPortConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleCookiesConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleCookiesConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleHTTPVersionConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleHttpVersionConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleHostNameConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleHostNameConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleIsDeviceConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRulePostArgsConditionParameters DeliveryRuleConditionParametersType = "DeliveryRulePostArgsConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleQueryStringConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleQueryStringConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleRemoteAddressConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRemoteAddressConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleRequestBodyConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestBodyConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleRequestHeaderConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestHeaderConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestMethodConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleRequestSchemeConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestSchemeConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleRequestUriConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestUriConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleServerPortConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleServerPortConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleSocketAddrConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleSocketAddrConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleSslProtocolConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleSslProtocolConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleUrlFileExtensionMatchConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleURLFilenameConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleUrlFilenameConditionParameters" + DeliveryRuleConditionParametersTypeDeliveryRuleURLPathMatchConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleUrlPathMatchConditionParameters" +) + +func PossibleValuesForDeliveryRuleConditionParametersType() []string { + return []string{ + string(DeliveryRuleConditionParametersTypeDeliveryRuleClientPortConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleCookiesConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleHTTPVersionConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleHostNameConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRulePostArgsConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleQueryStringConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleRemoteAddressConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestBodyConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestHeaderConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestSchemeConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestUriConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleServerPortConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleSocketAddrConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleSslProtocolConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleURLFilenameConditionParameters), + string(DeliveryRuleConditionParametersTypeDeliveryRuleURLPathMatchConditionParameters), + } +} + +func (s *DeliveryRuleConditionParametersType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeliveryRuleConditionParametersType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeliveryRuleConditionParametersType(input string) (*DeliveryRuleConditionParametersType, error) { + vals := map[string]DeliveryRuleConditionParametersType{ + "deliveryruleclientportconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleClientPortConditionParameters, + "deliveryrulecookiesconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleCookiesConditionParameters, + "deliveryrulehttpversionconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleHTTPVersionConditionParameters, + "deliveryrulehostnameconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleHostNameConditionParameters, + "deliveryruleisdeviceconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters, + "deliveryrulepostargsconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRulePostArgsConditionParameters, + "deliveryrulequerystringconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleQueryStringConditionParameters, + "deliveryruleremoteaddressconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRemoteAddressConditionParameters, + "deliveryrulerequestbodyconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestBodyConditionParameters, + "deliveryrulerequestheaderconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestHeaderConditionParameters, + "deliveryrulerequestmethodconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters, + "deliveryrulerequestschemeconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestSchemeConditionParameters, + "deliveryrulerequesturiconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestUriConditionParameters, + "deliveryruleserverportconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleServerPortConditionParameters, + "deliveryrulesocketaddrconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleSocketAddrConditionParameters, + "deliveryrulesslprotocolconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleSslProtocolConditionParameters, + "deliveryruleurlfileextensionmatchconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters, + "deliveryruleurlfilenameconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleURLFilenameConditionParameters, + "deliveryruleurlpathmatchconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleURLPathMatchConditionParameters, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeliveryRuleConditionParametersType(input) + return &out, nil +} + +type DeploymentStatus string + +const ( + DeploymentStatusFailed DeploymentStatus = "Failed" + DeploymentStatusInProgress DeploymentStatus = "InProgress" + DeploymentStatusNotStarted DeploymentStatus = "NotStarted" + DeploymentStatusSucceeded DeploymentStatus = "Succeeded" +) + +func PossibleValuesForDeploymentStatus() []string { + return []string{ + string(DeploymentStatusFailed), + string(DeploymentStatusInProgress), + string(DeploymentStatusNotStarted), + string(DeploymentStatusSucceeded), + } +} + +func (s *DeploymentStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeploymentStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeploymentStatus(input string) (*DeploymentStatus, error) { + vals := map[string]DeploymentStatus{ + "failed": DeploymentStatusFailed, + "inprogress": DeploymentStatusInProgress, + "notstarted": DeploymentStatusNotStarted, + "succeeded": DeploymentStatusSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeploymentStatus(input) + return &out, nil +} + +type DestinationProtocol string + +const ( + DestinationProtocolHTTP DestinationProtocol = "Http" + DestinationProtocolHTTPS DestinationProtocol = "Https" + DestinationProtocolMatchRequest DestinationProtocol = "MatchRequest" +) + +func PossibleValuesForDestinationProtocol() []string { + return []string{ + string(DestinationProtocolHTTP), + string(DestinationProtocolHTTPS), + string(DestinationProtocolMatchRequest), + } +} + +func (s *DestinationProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDestinationProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDestinationProtocol(input string) (*DestinationProtocol, error) { + vals := map[string]DestinationProtocol{ + "http": DestinationProtocolHTTP, + "https": DestinationProtocolHTTPS, + "matchrequest": DestinationProtocolMatchRequest, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DestinationProtocol(input) + return &out, nil +} + +type ForwardingProtocol string + +const ( + ForwardingProtocolHTTPOnly ForwardingProtocol = "HttpOnly" + ForwardingProtocolHTTPSOnly ForwardingProtocol = "HttpsOnly" + ForwardingProtocolMatchRequest ForwardingProtocol = "MatchRequest" +) + +func PossibleValuesForForwardingProtocol() []string { + return []string{ + string(ForwardingProtocolHTTPOnly), + string(ForwardingProtocolHTTPSOnly), + string(ForwardingProtocolMatchRequest), + } +} + +func (s *ForwardingProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForwardingProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForwardingProtocol(input string) (*ForwardingProtocol, error) { + vals := map[string]ForwardingProtocol{ + "httponly": ForwardingProtocolHTTPOnly, + "httpsonly": ForwardingProtocolHTTPSOnly, + "matchrequest": ForwardingProtocolMatchRequest, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ForwardingProtocol(input) + return &out, nil +} + +type HTTPVersionOperator string + +const ( + HTTPVersionOperatorEqual HTTPVersionOperator = "Equal" +) + +func PossibleValuesForHTTPVersionOperator() []string { + return []string{ + string(HTTPVersionOperatorEqual), + } +} + +func (s *HTTPVersionOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHTTPVersionOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHTTPVersionOperator(input string) (*HTTPVersionOperator, error) { + vals := map[string]HTTPVersionOperator{ + "equal": HTTPVersionOperatorEqual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HTTPVersionOperator(input) + return &out, nil +} + +type HeaderAction string + +const ( + HeaderActionAppend HeaderAction = "Append" + HeaderActionDelete HeaderAction = "Delete" + HeaderActionOverwrite HeaderAction = "Overwrite" +) + +func PossibleValuesForHeaderAction() []string { + return []string{ + string(HeaderActionAppend), + string(HeaderActionDelete), + string(HeaderActionOverwrite), + } +} + +func (s *HeaderAction) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHeaderAction(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHeaderAction(input string) (*HeaderAction, error) { + vals := map[string]HeaderAction{ + "append": HeaderActionAppend, + "delete": HeaderActionDelete, + "overwrite": HeaderActionOverwrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HeaderAction(input) + return &out, nil +} + +type HostNameOperator string + +const ( + HostNameOperatorAny HostNameOperator = "Any" + HostNameOperatorBeginsWith HostNameOperator = "BeginsWith" + HostNameOperatorContains HostNameOperator = "Contains" + HostNameOperatorEndsWith HostNameOperator = "EndsWith" + HostNameOperatorEqual HostNameOperator = "Equal" + HostNameOperatorGreaterThan HostNameOperator = "GreaterThan" + HostNameOperatorGreaterThanOrEqual HostNameOperator = "GreaterThanOrEqual" + HostNameOperatorLessThan HostNameOperator = "LessThan" + HostNameOperatorLessThanOrEqual HostNameOperator = "LessThanOrEqual" + HostNameOperatorRegEx HostNameOperator = "RegEx" +) + +func PossibleValuesForHostNameOperator() []string { + return []string{ + string(HostNameOperatorAny), + string(HostNameOperatorBeginsWith), + string(HostNameOperatorContains), + string(HostNameOperatorEndsWith), + string(HostNameOperatorEqual), + string(HostNameOperatorGreaterThan), + string(HostNameOperatorGreaterThanOrEqual), + string(HostNameOperatorLessThan), + string(HostNameOperatorLessThanOrEqual), + string(HostNameOperatorRegEx), + } +} + +func (s *HostNameOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHostNameOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHostNameOperator(input string) (*HostNameOperator, error) { + vals := map[string]HostNameOperator{ + "any": HostNameOperatorAny, + "beginswith": HostNameOperatorBeginsWith, + "contains": HostNameOperatorContains, + "endswith": HostNameOperatorEndsWith, + "equal": HostNameOperatorEqual, + "greaterthan": HostNameOperatorGreaterThan, + "greaterthanorequal": HostNameOperatorGreaterThanOrEqual, + "lessthan": HostNameOperatorLessThan, + "lessthanorequal": HostNameOperatorLessThanOrEqual, + "regex": HostNameOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HostNameOperator(input) + return &out, nil +} + +type IsDeviceMatchValue string + +const ( + IsDeviceMatchValueDesktop IsDeviceMatchValue = "Desktop" + IsDeviceMatchValueMobile IsDeviceMatchValue = "Mobile" +) + +func PossibleValuesForIsDeviceMatchValue() []string { + return []string{ + string(IsDeviceMatchValueDesktop), + string(IsDeviceMatchValueMobile), + } +} + +func (s *IsDeviceMatchValue) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIsDeviceMatchValue(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIsDeviceMatchValue(input string) (*IsDeviceMatchValue, error) { + vals := map[string]IsDeviceMatchValue{ + "desktop": IsDeviceMatchValueDesktop, + "mobile": IsDeviceMatchValueMobile, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IsDeviceMatchValue(input) + return &out, nil +} + +type IsDeviceOperator string + +const ( + IsDeviceOperatorEqual IsDeviceOperator = "Equal" +) + +func PossibleValuesForIsDeviceOperator() []string { + return []string{ + string(IsDeviceOperatorEqual), + } +} + +func (s *IsDeviceOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIsDeviceOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIsDeviceOperator(input string) (*IsDeviceOperator, error) { + vals := map[string]IsDeviceOperator{ + "equal": IsDeviceOperatorEqual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IsDeviceOperator(input) + return &out, nil +} + +type MatchProcessingBehavior string + +const ( + MatchProcessingBehaviorContinue MatchProcessingBehavior = "Continue" + MatchProcessingBehaviorStop MatchProcessingBehavior = "Stop" +) + +func PossibleValuesForMatchProcessingBehavior() []string { + return []string{ + string(MatchProcessingBehaviorContinue), + string(MatchProcessingBehaviorStop), + } +} + +func (s *MatchProcessingBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMatchProcessingBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMatchProcessingBehavior(input string) (*MatchProcessingBehavior, error) { + vals := map[string]MatchProcessingBehavior{ + "continue": MatchProcessingBehaviorContinue, + "stop": MatchProcessingBehaviorStop, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MatchProcessingBehavior(input) + return &out, nil +} + +type MatchVariable string + +const ( + MatchVariableClientPort MatchVariable = "ClientPort" + MatchVariableCookies MatchVariable = "Cookies" + MatchVariableHTTPVersion MatchVariable = "HttpVersion" + MatchVariableHostName MatchVariable = "HostName" + MatchVariableIsDevice MatchVariable = "IsDevice" + MatchVariablePostArgs MatchVariable = "PostArgs" + MatchVariableQueryString MatchVariable = "QueryString" + MatchVariableRemoteAddress MatchVariable = "RemoteAddress" + MatchVariableRequestBody MatchVariable = "RequestBody" + MatchVariableRequestHeader MatchVariable = "RequestHeader" + MatchVariableRequestMethod MatchVariable = "RequestMethod" + MatchVariableRequestScheme MatchVariable = "RequestScheme" + MatchVariableRequestUri MatchVariable = "RequestUri" + MatchVariableServerPort MatchVariable = "ServerPort" + MatchVariableSocketAddr MatchVariable = "SocketAddr" + MatchVariableSslProtocol MatchVariable = "SslProtocol" + MatchVariableURLFileExtension MatchVariable = "UrlFileExtension" + MatchVariableURLFileName MatchVariable = "UrlFileName" + MatchVariableURLPath MatchVariable = "UrlPath" +) + +func PossibleValuesForMatchVariable() []string { + return []string{ + string(MatchVariableClientPort), + string(MatchVariableCookies), + string(MatchVariableHTTPVersion), + string(MatchVariableHostName), + string(MatchVariableIsDevice), + string(MatchVariablePostArgs), + string(MatchVariableQueryString), + string(MatchVariableRemoteAddress), + string(MatchVariableRequestBody), + string(MatchVariableRequestHeader), + string(MatchVariableRequestMethod), + string(MatchVariableRequestScheme), + string(MatchVariableRequestUri), + string(MatchVariableServerPort), + string(MatchVariableSocketAddr), + string(MatchVariableSslProtocol), + string(MatchVariableURLFileExtension), + string(MatchVariableURLFileName), + string(MatchVariableURLPath), + } +} + +func (s *MatchVariable) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMatchVariable(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMatchVariable(input string) (*MatchVariable, error) { + vals := map[string]MatchVariable{ + "clientport": MatchVariableClientPort, + "cookies": MatchVariableCookies, + "httpversion": MatchVariableHTTPVersion, + "hostname": MatchVariableHostName, + "isdevice": MatchVariableIsDevice, + "postargs": MatchVariablePostArgs, + "querystring": MatchVariableQueryString, + "remoteaddress": MatchVariableRemoteAddress, + "requestbody": MatchVariableRequestBody, + "requestheader": MatchVariableRequestHeader, + "requestmethod": MatchVariableRequestMethod, + "requestscheme": MatchVariableRequestScheme, + "requesturi": MatchVariableRequestUri, + "serverport": MatchVariableServerPort, + "socketaddr": MatchVariableSocketAddr, + "sslprotocol": MatchVariableSslProtocol, + "urlfileextension": MatchVariableURLFileExtension, + "urlfilename": MatchVariableURLFileName, + "urlpath": MatchVariableURLPath, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MatchVariable(input) + return &out, nil +} + +type Operator string + +const ( + OperatorEqual Operator = "Equal" +) + +func PossibleValuesForOperator() []string { + return []string{ + string(OperatorEqual), + } +} + +func (s *Operator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperator(input string) (*Operator, error) { + vals := map[string]Operator{ + "equal": OperatorEqual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Operator(input) + return &out, nil +} + +type ParamIndicator string + +const ( + ParamIndicatorExpires ParamIndicator = "Expires" + ParamIndicatorKeyId ParamIndicator = "KeyId" + ParamIndicatorSignature ParamIndicator = "Signature" +) + +func PossibleValuesForParamIndicator() []string { + return []string{ + string(ParamIndicatorExpires), + string(ParamIndicatorKeyId), + string(ParamIndicatorSignature), + } +} + +func (s *ParamIndicator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseParamIndicator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseParamIndicator(input string) (*ParamIndicator, error) { + vals := map[string]ParamIndicator{ + "expires": ParamIndicatorExpires, + "keyid": ParamIndicatorKeyId, + "signature": ParamIndicatorSignature, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ParamIndicator(input) + return &out, nil +} + +type PostArgsOperator string + +const ( + PostArgsOperatorAny PostArgsOperator = "Any" + PostArgsOperatorBeginsWith PostArgsOperator = "BeginsWith" + PostArgsOperatorContains PostArgsOperator = "Contains" + PostArgsOperatorEndsWith PostArgsOperator = "EndsWith" + PostArgsOperatorEqual PostArgsOperator = "Equal" + PostArgsOperatorGreaterThan PostArgsOperator = "GreaterThan" + PostArgsOperatorGreaterThanOrEqual PostArgsOperator = "GreaterThanOrEqual" + PostArgsOperatorLessThan PostArgsOperator = "LessThan" + PostArgsOperatorLessThanOrEqual PostArgsOperator = "LessThanOrEqual" + PostArgsOperatorRegEx PostArgsOperator = "RegEx" +) + +func PossibleValuesForPostArgsOperator() []string { + return []string{ + string(PostArgsOperatorAny), + string(PostArgsOperatorBeginsWith), + string(PostArgsOperatorContains), + string(PostArgsOperatorEndsWith), + string(PostArgsOperatorEqual), + string(PostArgsOperatorGreaterThan), + string(PostArgsOperatorGreaterThanOrEqual), + string(PostArgsOperatorLessThan), + string(PostArgsOperatorLessThanOrEqual), + string(PostArgsOperatorRegEx), + } +} + +func (s *PostArgsOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePostArgsOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePostArgsOperator(input string) (*PostArgsOperator, error) { + vals := map[string]PostArgsOperator{ + "any": PostArgsOperatorAny, + "beginswith": PostArgsOperatorBeginsWith, + "contains": PostArgsOperatorContains, + "endswith": PostArgsOperatorEndsWith, + "equal": PostArgsOperatorEqual, + "greaterthan": PostArgsOperatorGreaterThan, + "greaterthanorequal": PostArgsOperatorGreaterThanOrEqual, + "lessthan": PostArgsOperatorLessThan, + "lessthanorequal": PostArgsOperatorLessThanOrEqual, + "regex": PostArgsOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PostArgsOperator(input) + return &out, nil +} + +type QueryStringBehavior string + +const ( + QueryStringBehaviorExclude QueryStringBehavior = "Exclude" + QueryStringBehaviorExcludeAll QueryStringBehavior = "ExcludeAll" + QueryStringBehaviorInclude QueryStringBehavior = "Include" + QueryStringBehaviorIncludeAll QueryStringBehavior = "IncludeAll" +) + +func PossibleValuesForQueryStringBehavior() []string { + return []string{ + string(QueryStringBehaviorExclude), + string(QueryStringBehaviorExcludeAll), + string(QueryStringBehaviorInclude), + string(QueryStringBehaviorIncludeAll), + } +} + +func (s *QueryStringBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseQueryStringBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseQueryStringBehavior(input string) (*QueryStringBehavior, error) { + vals := map[string]QueryStringBehavior{ + "exclude": QueryStringBehaviorExclude, + "excludeall": QueryStringBehaviorExcludeAll, + "include": QueryStringBehaviorInclude, + "includeall": QueryStringBehaviorIncludeAll, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := QueryStringBehavior(input) + return &out, nil +} + +type QueryStringOperator string + +const ( + QueryStringOperatorAny QueryStringOperator = "Any" + QueryStringOperatorBeginsWith QueryStringOperator = "BeginsWith" + QueryStringOperatorContains QueryStringOperator = "Contains" + QueryStringOperatorEndsWith QueryStringOperator = "EndsWith" + QueryStringOperatorEqual QueryStringOperator = "Equal" + QueryStringOperatorGreaterThan QueryStringOperator = "GreaterThan" + QueryStringOperatorGreaterThanOrEqual QueryStringOperator = "GreaterThanOrEqual" + QueryStringOperatorLessThan QueryStringOperator = "LessThan" + QueryStringOperatorLessThanOrEqual QueryStringOperator = "LessThanOrEqual" + QueryStringOperatorRegEx QueryStringOperator = "RegEx" +) + +func PossibleValuesForQueryStringOperator() []string { + return []string{ + string(QueryStringOperatorAny), + string(QueryStringOperatorBeginsWith), + string(QueryStringOperatorContains), + string(QueryStringOperatorEndsWith), + string(QueryStringOperatorEqual), + string(QueryStringOperatorGreaterThan), + string(QueryStringOperatorGreaterThanOrEqual), + string(QueryStringOperatorLessThan), + string(QueryStringOperatorLessThanOrEqual), + string(QueryStringOperatorRegEx), + } +} + +func (s *QueryStringOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseQueryStringOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseQueryStringOperator(input string) (*QueryStringOperator, error) { + vals := map[string]QueryStringOperator{ + "any": QueryStringOperatorAny, + "beginswith": QueryStringOperatorBeginsWith, + "contains": QueryStringOperatorContains, + "endswith": QueryStringOperatorEndsWith, + "equal": QueryStringOperatorEqual, + "greaterthan": QueryStringOperatorGreaterThan, + "greaterthanorequal": QueryStringOperatorGreaterThanOrEqual, + "lessthan": QueryStringOperatorLessThan, + "lessthanorequal": QueryStringOperatorLessThanOrEqual, + "regex": QueryStringOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := QueryStringOperator(input) + return &out, nil +} + +type RedirectType string + +const ( + RedirectTypeFound RedirectType = "Found" + RedirectTypeMoved RedirectType = "Moved" + RedirectTypePermanentRedirect RedirectType = "PermanentRedirect" + RedirectTypeTemporaryRedirect RedirectType = "TemporaryRedirect" +) + +func PossibleValuesForRedirectType() []string { + return []string{ + string(RedirectTypeFound), + string(RedirectTypeMoved), + string(RedirectTypePermanentRedirect), + string(RedirectTypeTemporaryRedirect), + } +} + +func (s *RedirectType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRedirectType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRedirectType(input string) (*RedirectType, error) { + vals := map[string]RedirectType{ + "found": RedirectTypeFound, + "moved": RedirectTypeMoved, + "permanentredirect": RedirectTypePermanentRedirect, + "temporaryredirect": RedirectTypeTemporaryRedirect, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RedirectType(input) + return &out, nil +} + +type RemoteAddressOperator string + +const ( + RemoteAddressOperatorAny RemoteAddressOperator = "Any" + RemoteAddressOperatorGeoMatch RemoteAddressOperator = "GeoMatch" + RemoteAddressOperatorIPMatch RemoteAddressOperator = "IPMatch" +) + +func PossibleValuesForRemoteAddressOperator() []string { + return []string{ + string(RemoteAddressOperatorAny), + string(RemoteAddressOperatorGeoMatch), + string(RemoteAddressOperatorIPMatch), + } +} + +func (s *RemoteAddressOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRemoteAddressOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRemoteAddressOperator(input string) (*RemoteAddressOperator, error) { + vals := map[string]RemoteAddressOperator{ + "any": RemoteAddressOperatorAny, + "geomatch": RemoteAddressOperatorGeoMatch, + "ipmatch": RemoteAddressOperatorIPMatch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RemoteAddressOperator(input) + return &out, nil +} + +type RequestBodyOperator string + +const ( + RequestBodyOperatorAny RequestBodyOperator = "Any" + RequestBodyOperatorBeginsWith RequestBodyOperator = "BeginsWith" + RequestBodyOperatorContains RequestBodyOperator = "Contains" + RequestBodyOperatorEndsWith RequestBodyOperator = "EndsWith" + RequestBodyOperatorEqual RequestBodyOperator = "Equal" + RequestBodyOperatorGreaterThan RequestBodyOperator = "GreaterThan" + RequestBodyOperatorGreaterThanOrEqual RequestBodyOperator = "GreaterThanOrEqual" + RequestBodyOperatorLessThan RequestBodyOperator = "LessThan" + RequestBodyOperatorLessThanOrEqual RequestBodyOperator = "LessThanOrEqual" + RequestBodyOperatorRegEx RequestBodyOperator = "RegEx" +) + +func PossibleValuesForRequestBodyOperator() []string { + return []string{ + string(RequestBodyOperatorAny), + string(RequestBodyOperatorBeginsWith), + string(RequestBodyOperatorContains), + string(RequestBodyOperatorEndsWith), + string(RequestBodyOperatorEqual), + string(RequestBodyOperatorGreaterThan), + string(RequestBodyOperatorGreaterThanOrEqual), + string(RequestBodyOperatorLessThan), + string(RequestBodyOperatorLessThanOrEqual), + string(RequestBodyOperatorRegEx), + } +} + +func (s *RequestBodyOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRequestBodyOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRequestBodyOperator(input string) (*RequestBodyOperator, error) { + vals := map[string]RequestBodyOperator{ + "any": RequestBodyOperatorAny, + "beginswith": RequestBodyOperatorBeginsWith, + "contains": RequestBodyOperatorContains, + "endswith": RequestBodyOperatorEndsWith, + "equal": RequestBodyOperatorEqual, + "greaterthan": RequestBodyOperatorGreaterThan, + "greaterthanorequal": RequestBodyOperatorGreaterThanOrEqual, + "lessthan": RequestBodyOperatorLessThan, + "lessthanorequal": RequestBodyOperatorLessThanOrEqual, + "regex": RequestBodyOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequestBodyOperator(input) + return &out, nil +} + +type RequestHeaderOperator string + +const ( + RequestHeaderOperatorAny RequestHeaderOperator = "Any" + RequestHeaderOperatorBeginsWith RequestHeaderOperator = "BeginsWith" + RequestHeaderOperatorContains RequestHeaderOperator = "Contains" + RequestHeaderOperatorEndsWith RequestHeaderOperator = "EndsWith" + RequestHeaderOperatorEqual RequestHeaderOperator = "Equal" + RequestHeaderOperatorGreaterThan RequestHeaderOperator = "GreaterThan" + RequestHeaderOperatorGreaterThanOrEqual RequestHeaderOperator = "GreaterThanOrEqual" + RequestHeaderOperatorLessThan RequestHeaderOperator = "LessThan" + RequestHeaderOperatorLessThanOrEqual RequestHeaderOperator = "LessThanOrEqual" + RequestHeaderOperatorRegEx RequestHeaderOperator = "RegEx" +) + +func PossibleValuesForRequestHeaderOperator() []string { + return []string{ + string(RequestHeaderOperatorAny), + string(RequestHeaderOperatorBeginsWith), + string(RequestHeaderOperatorContains), + string(RequestHeaderOperatorEndsWith), + string(RequestHeaderOperatorEqual), + string(RequestHeaderOperatorGreaterThan), + string(RequestHeaderOperatorGreaterThanOrEqual), + string(RequestHeaderOperatorLessThan), + string(RequestHeaderOperatorLessThanOrEqual), + string(RequestHeaderOperatorRegEx), + } +} + +func (s *RequestHeaderOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRequestHeaderOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRequestHeaderOperator(input string) (*RequestHeaderOperator, error) { + vals := map[string]RequestHeaderOperator{ + "any": RequestHeaderOperatorAny, + "beginswith": RequestHeaderOperatorBeginsWith, + "contains": RequestHeaderOperatorContains, + "endswith": RequestHeaderOperatorEndsWith, + "equal": RequestHeaderOperatorEqual, + "greaterthan": RequestHeaderOperatorGreaterThan, + "greaterthanorequal": RequestHeaderOperatorGreaterThanOrEqual, + "lessthan": RequestHeaderOperatorLessThan, + "lessthanorequal": RequestHeaderOperatorLessThanOrEqual, + "regex": RequestHeaderOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequestHeaderOperator(input) + return &out, nil +} + +type RequestMethodMatchValue string + +const ( + RequestMethodMatchValueDELETE RequestMethodMatchValue = "DELETE" + RequestMethodMatchValueGET RequestMethodMatchValue = "GET" + RequestMethodMatchValueHEAD RequestMethodMatchValue = "HEAD" + RequestMethodMatchValueOPTIONS RequestMethodMatchValue = "OPTIONS" + RequestMethodMatchValuePOST RequestMethodMatchValue = "POST" + RequestMethodMatchValuePUT RequestMethodMatchValue = "PUT" + RequestMethodMatchValueTRACE RequestMethodMatchValue = "TRACE" +) + +func PossibleValuesForRequestMethodMatchValue() []string { + return []string{ + string(RequestMethodMatchValueDELETE), + string(RequestMethodMatchValueGET), + string(RequestMethodMatchValueHEAD), + string(RequestMethodMatchValueOPTIONS), + string(RequestMethodMatchValuePOST), + string(RequestMethodMatchValuePUT), + string(RequestMethodMatchValueTRACE), + } +} + +func (s *RequestMethodMatchValue) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRequestMethodMatchValue(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRequestMethodMatchValue(input string) (*RequestMethodMatchValue, error) { + vals := map[string]RequestMethodMatchValue{ + "delete": RequestMethodMatchValueDELETE, + "get": RequestMethodMatchValueGET, + "head": RequestMethodMatchValueHEAD, + "options": RequestMethodMatchValueOPTIONS, + "post": RequestMethodMatchValuePOST, + "put": RequestMethodMatchValuePUT, + "trace": RequestMethodMatchValueTRACE, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequestMethodMatchValue(input) + return &out, nil +} + +type RequestMethodOperator string + +const ( + RequestMethodOperatorEqual RequestMethodOperator = "Equal" +) + +func PossibleValuesForRequestMethodOperator() []string { + return []string{ + string(RequestMethodOperatorEqual), + } +} + +func (s *RequestMethodOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRequestMethodOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRequestMethodOperator(input string) (*RequestMethodOperator, error) { + vals := map[string]RequestMethodOperator{ + "equal": RequestMethodOperatorEqual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequestMethodOperator(input) + return &out, nil +} + +type RequestSchemeMatchValue string + +const ( + RequestSchemeMatchValueHTTP RequestSchemeMatchValue = "HTTP" + RequestSchemeMatchValueHTTPS RequestSchemeMatchValue = "HTTPS" +) + +func PossibleValuesForRequestSchemeMatchValue() []string { + return []string{ + string(RequestSchemeMatchValueHTTP), + string(RequestSchemeMatchValueHTTPS), + } +} + +func (s *RequestSchemeMatchValue) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRequestSchemeMatchValue(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRequestSchemeMatchValue(input string) (*RequestSchemeMatchValue, error) { + vals := map[string]RequestSchemeMatchValue{ + "http": RequestSchemeMatchValueHTTP, + "https": RequestSchemeMatchValueHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequestSchemeMatchValue(input) + return &out, nil +} + +type RequestUriOperator string + +const ( + RequestUriOperatorAny RequestUriOperator = "Any" + RequestUriOperatorBeginsWith RequestUriOperator = "BeginsWith" + RequestUriOperatorContains RequestUriOperator = "Contains" + RequestUriOperatorEndsWith RequestUriOperator = "EndsWith" + RequestUriOperatorEqual RequestUriOperator = "Equal" + RequestUriOperatorGreaterThan RequestUriOperator = "GreaterThan" + RequestUriOperatorGreaterThanOrEqual RequestUriOperator = "GreaterThanOrEqual" + RequestUriOperatorLessThan RequestUriOperator = "LessThan" + RequestUriOperatorLessThanOrEqual RequestUriOperator = "LessThanOrEqual" + RequestUriOperatorRegEx RequestUriOperator = "RegEx" +) + +func PossibleValuesForRequestUriOperator() []string { + return []string{ + string(RequestUriOperatorAny), + string(RequestUriOperatorBeginsWith), + string(RequestUriOperatorContains), + string(RequestUriOperatorEndsWith), + string(RequestUriOperatorEqual), + string(RequestUriOperatorGreaterThan), + string(RequestUriOperatorGreaterThanOrEqual), + string(RequestUriOperatorLessThan), + string(RequestUriOperatorLessThanOrEqual), + string(RequestUriOperatorRegEx), + } +} + +func (s *RequestUriOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRequestUriOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRequestUriOperator(input string) (*RequestUriOperator, error) { + vals := map[string]RequestUriOperator{ + "any": RequestUriOperatorAny, + "beginswith": RequestUriOperatorBeginsWith, + "contains": RequestUriOperatorContains, + "endswith": RequestUriOperatorEndsWith, + "equal": RequestUriOperatorEqual, + "greaterthan": RequestUriOperatorGreaterThan, + "greaterthanorequal": RequestUriOperatorGreaterThanOrEqual, + "lessthan": RequestUriOperatorLessThan, + "lessthanorequal": RequestUriOperatorLessThanOrEqual, + "regex": RequestUriOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequestUriOperator(input) + return &out, nil +} + +type RuleCacheBehavior string + +const ( + RuleCacheBehaviorHonorOrigin RuleCacheBehavior = "HonorOrigin" + RuleCacheBehaviorOverrideAlways RuleCacheBehavior = "OverrideAlways" + RuleCacheBehaviorOverrideIfOriginMissing RuleCacheBehavior = "OverrideIfOriginMissing" +) + +func PossibleValuesForRuleCacheBehavior() []string { + return []string{ + string(RuleCacheBehaviorHonorOrigin), + string(RuleCacheBehaviorOverrideAlways), + string(RuleCacheBehaviorOverrideIfOriginMissing), + } +} + +func (s *RuleCacheBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRuleCacheBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRuleCacheBehavior(input string) (*RuleCacheBehavior, error) { + vals := map[string]RuleCacheBehavior{ + "honororigin": RuleCacheBehaviorHonorOrigin, + "overridealways": RuleCacheBehaviorOverrideAlways, + "overrideiforiginmissing": RuleCacheBehaviorOverrideIfOriginMissing, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RuleCacheBehavior(input) + return &out, nil +} + +type RuleIsCompressionEnabled string + +const ( + RuleIsCompressionEnabledDisabled RuleIsCompressionEnabled = "Disabled" + RuleIsCompressionEnabledEnabled RuleIsCompressionEnabled = "Enabled" +) + +func PossibleValuesForRuleIsCompressionEnabled() []string { + return []string{ + string(RuleIsCompressionEnabledDisabled), + string(RuleIsCompressionEnabledEnabled), + } +} + +func (s *RuleIsCompressionEnabled) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRuleIsCompressionEnabled(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRuleIsCompressionEnabled(input string) (*RuleIsCompressionEnabled, error) { + vals := map[string]RuleIsCompressionEnabled{ + "disabled": RuleIsCompressionEnabledDisabled, + "enabled": RuleIsCompressionEnabledEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RuleIsCompressionEnabled(input) + return &out, nil +} + +type RuleQueryStringCachingBehavior string + +const ( + RuleQueryStringCachingBehaviorIgnoreQueryString RuleQueryStringCachingBehavior = "IgnoreQueryString" + RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings RuleQueryStringCachingBehavior = "IgnoreSpecifiedQueryStrings" + RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings RuleQueryStringCachingBehavior = "IncludeSpecifiedQueryStrings" + RuleQueryStringCachingBehaviorUseQueryString RuleQueryStringCachingBehavior = "UseQueryString" +) + +func PossibleValuesForRuleQueryStringCachingBehavior() []string { + return []string{ + string(RuleQueryStringCachingBehaviorIgnoreQueryString), + string(RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings), + string(RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings), + string(RuleQueryStringCachingBehaviorUseQueryString), + } +} + +func (s *RuleQueryStringCachingBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRuleQueryStringCachingBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRuleQueryStringCachingBehavior(input string) (*RuleQueryStringCachingBehavior, error) { + vals := map[string]RuleQueryStringCachingBehavior{ + "ignorequerystring": RuleQueryStringCachingBehaviorIgnoreQueryString, + "ignorespecifiedquerystrings": RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings, + "includespecifiedquerystrings": RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings, + "usequerystring": RuleQueryStringCachingBehaviorUseQueryString, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RuleQueryStringCachingBehavior(input) + return &out, nil +} + +type ServerPortOperator string + +const ( + ServerPortOperatorAny ServerPortOperator = "Any" + ServerPortOperatorBeginsWith ServerPortOperator = "BeginsWith" + ServerPortOperatorContains ServerPortOperator = "Contains" + ServerPortOperatorEndsWith ServerPortOperator = "EndsWith" + ServerPortOperatorEqual ServerPortOperator = "Equal" + ServerPortOperatorGreaterThan ServerPortOperator = "GreaterThan" + ServerPortOperatorGreaterThanOrEqual ServerPortOperator = "GreaterThanOrEqual" + ServerPortOperatorLessThan ServerPortOperator = "LessThan" + ServerPortOperatorLessThanOrEqual ServerPortOperator = "LessThanOrEqual" + ServerPortOperatorRegEx ServerPortOperator = "RegEx" +) + +func PossibleValuesForServerPortOperator() []string { + return []string{ + string(ServerPortOperatorAny), + string(ServerPortOperatorBeginsWith), + string(ServerPortOperatorContains), + string(ServerPortOperatorEndsWith), + string(ServerPortOperatorEqual), + string(ServerPortOperatorGreaterThan), + string(ServerPortOperatorGreaterThanOrEqual), + string(ServerPortOperatorLessThan), + string(ServerPortOperatorLessThanOrEqual), + string(ServerPortOperatorRegEx), + } +} + +func (s *ServerPortOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseServerPortOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseServerPortOperator(input string) (*ServerPortOperator, error) { + vals := map[string]ServerPortOperator{ + "any": ServerPortOperatorAny, + "beginswith": ServerPortOperatorBeginsWith, + "contains": ServerPortOperatorContains, + "endswith": ServerPortOperatorEndsWith, + "equal": ServerPortOperatorEqual, + "greaterthan": ServerPortOperatorGreaterThan, + "greaterthanorequal": ServerPortOperatorGreaterThanOrEqual, + "lessthan": ServerPortOperatorLessThan, + "lessthanorequal": ServerPortOperatorLessThanOrEqual, + "regex": ServerPortOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerPortOperator(input) + return &out, nil +} + +type SocketAddrOperator string + +const ( + SocketAddrOperatorAny SocketAddrOperator = "Any" + SocketAddrOperatorIPMatch SocketAddrOperator = "IPMatch" +) + +func PossibleValuesForSocketAddrOperator() []string { + return []string{ + string(SocketAddrOperatorAny), + string(SocketAddrOperatorIPMatch), + } +} + +func (s *SocketAddrOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSocketAddrOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSocketAddrOperator(input string) (*SocketAddrOperator, error) { + vals := map[string]SocketAddrOperator{ + "any": SocketAddrOperatorAny, + "ipmatch": SocketAddrOperatorIPMatch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SocketAddrOperator(input) + return &out, nil +} + +type SslProtocol string + +const ( + SslProtocolTLSvOne SslProtocol = "TLSv1" + SslProtocolTLSvOnePointOne SslProtocol = "TLSv1.1" + SslProtocolTLSvOnePointTwo SslProtocol = "TLSv1.2" +) + +func PossibleValuesForSslProtocol() []string { + return []string{ + string(SslProtocolTLSvOne), + string(SslProtocolTLSvOnePointOne), + string(SslProtocolTLSvOnePointTwo), + } +} + +func (s *SslProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSslProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSslProtocol(input string) (*SslProtocol, error) { + vals := map[string]SslProtocol{ + "tlsv1": SslProtocolTLSvOne, + "tlsv1.1": SslProtocolTLSvOnePointOne, + "tlsv1.2": SslProtocolTLSvOnePointTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslProtocol(input) + return &out, nil +} + +type SslProtocolOperator string + +const ( + SslProtocolOperatorEqual SslProtocolOperator = "Equal" +) + +func PossibleValuesForSslProtocolOperator() []string { + return []string{ + string(SslProtocolOperatorEqual), + } +} + +func (s *SslProtocolOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSslProtocolOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSslProtocolOperator(input string) (*SslProtocolOperator, error) { + vals := map[string]SslProtocolOperator{ + "equal": SslProtocolOperatorEqual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslProtocolOperator(input) + return &out, nil +} + +type Transform string + +const ( + TransformLowercase Transform = "Lowercase" + TransformRemoveNulls Transform = "RemoveNulls" + TransformTrim Transform = "Trim" + TransformURLDecode Transform = "UrlDecode" + TransformURLEncode Transform = "UrlEncode" + TransformUppercase Transform = "Uppercase" +) + +func PossibleValuesForTransform() []string { + return []string{ + string(TransformLowercase), + string(TransformRemoveNulls), + string(TransformTrim), + string(TransformURLDecode), + string(TransformURLEncode), + string(TransformUppercase), + } +} + +func (s *Transform) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTransform(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTransform(input string) (*Transform, error) { + vals := map[string]Transform{ + "lowercase": TransformLowercase, + "removenulls": TransformRemoveNulls, + "trim": TransformTrim, + "urldecode": TransformURLDecode, + "urlencode": TransformURLEncode, + "uppercase": TransformUppercase, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Transform(input) + return &out, nil +} + +type URLFileExtensionOperator string + +const ( + URLFileExtensionOperatorAny URLFileExtensionOperator = "Any" + URLFileExtensionOperatorBeginsWith URLFileExtensionOperator = "BeginsWith" + URLFileExtensionOperatorContains URLFileExtensionOperator = "Contains" + URLFileExtensionOperatorEndsWith URLFileExtensionOperator = "EndsWith" + URLFileExtensionOperatorEqual URLFileExtensionOperator = "Equal" + URLFileExtensionOperatorGreaterThan URLFileExtensionOperator = "GreaterThan" + URLFileExtensionOperatorGreaterThanOrEqual URLFileExtensionOperator = "GreaterThanOrEqual" + URLFileExtensionOperatorLessThan URLFileExtensionOperator = "LessThan" + URLFileExtensionOperatorLessThanOrEqual URLFileExtensionOperator = "LessThanOrEqual" + URLFileExtensionOperatorRegEx URLFileExtensionOperator = "RegEx" +) + +func PossibleValuesForURLFileExtensionOperator() []string { + return []string{ + string(URLFileExtensionOperatorAny), + string(URLFileExtensionOperatorBeginsWith), + string(URLFileExtensionOperatorContains), + string(URLFileExtensionOperatorEndsWith), + string(URLFileExtensionOperatorEqual), + string(URLFileExtensionOperatorGreaterThan), + string(URLFileExtensionOperatorGreaterThanOrEqual), + string(URLFileExtensionOperatorLessThan), + string(URLFileExtensionOperatorLessThanOrEqual), + string(URLFileExtensionOperatorRegEx), + } +} + +func (s *URLFileExtensionOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseURLFileExtensionOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseURLFileExtensionOperator(input string) (*URLFileExtensionOperator, error) { + vals := map[string]URLFileExtensionOperator{ + "any": URLFileExtensionOperatorAny, + "beginswith": URLFileExtensionOperatorBeginsWith, + "contains": URLFileExtensionOperatorContains, + "endswith": URLFileExtensionOperatorEndsWith, + "equal": URLFileExtensionOperatorEqual, + "greaterthan": URLFileExtensionOperatorGreaterThan, + "greaterthanorequal": URLFileExtensionOperatorGreaterThanOrEqual, + "lessthan": URLFileExtensionOperatorLessThan, + "lessthanorequal": URLFileExtensionOperatorLessThanOrEqual, + "regex": URLFileExtensionOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := URLFileExtensionOperator(input) + return &out, nil +} + +type URLFileNameOperator string + +const ( + URLFileNameOperatorAny URLFileNameOperator = "Any" + URLFileNameOperatorBeginsWith URLFileNameOperator = "BeginsWith" + URLFileNameOperatorContains URLFileNameOperator = "Contains" + URLFileNameOperatorEndsWith URLFileNameOperator = "EndsWith" + URLFileNameOperatorEqual URLFileNameOperator = "Equal" + URLFileNameOperatorGreaterThan URLFileNameOperator = "GreaterThan" + URLFileNameOperatorGreaterThanOrEqual URLFileNameOperator = "GreaterThanOrEqual" + URLFileNameOperatorLessThan URLFileNameOperator = "LessThan" + URLFileNameOperatorLessThanOrEqual URLFileNameOperator = "LessThanOrEqual" + URLFileNameOperatorRegEx URLFileNameOperator = "RegEx" +) + +func PossibleValuesForURLFileNameOperator() []string { + return []string{ + string(URLFileNameOperatorAny), + string(URLFileNameOperatorBeginsWith), + string(URLFileNameOperatorContains), + string(URLFileNameOperatorEndsWith), + string(URLFileNameOperatorEqual), + string(URLFileNameOperatorGreaterThan), + string(URLFileNameOperatorGreaterThanOrEqual), + string(URLFileNameOperatorLessThan), + string(URLFileNameOperatorLessThanOrEqual), + string(URLFileNameOperatorRegEx), + } +} + +func (s *URLFileNameOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseURLFileNameOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseURLFileNameOperator(input string) (*URLFileNameOperator, error) { + vals := map[string]URLFileNameOperator{ + "any": URLFileNameOperatorAny, + "beginswith": URLFileNameOperatorBeginsWith, + "contains": URLFileNameOperatorContains, + "endswith": URLFileNameOperatorEndsWith, + "equal": URLFileNameOperatorEqual, + "greaterthan": URLFileNameOperatorGreaterThan, + "greaterthanorequal": URLFileNameOperatorGreaterThanOrEqual, + "lessthan": URLFileNameOperatorLessThan, + "lessthanorequal": URLFileNameOperatorLessThanOrEqual, + "regex": URLFileNameOperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := URLFileNameOperator(input) + return &out, nil +} + +type URLPathOperator string + +const ( + URLPathOperatorAny URLPathOperator = "Any" + URLPathOperatorBeginsWith URLPathOperator = "BeginsWith" + URLPathOperatorContains URLPathOperator = "Contains" + URLPathOperatorEndsWith URLPathOperator = "EndsWith" + URLPathOperatorEqual URLPathOperator = "Equal" + URLPathOperatorGreaterThan URLPathOperator = "GreaterThan" + URLPathOperatorGreaterThanOrEqual URLPathOperator = "GreaterThanOrEqual" + URLPathOperatorLessThan URLPathOperator = "LessThan" + URLPathOperatorLessThanOrEqual URLPathOperator = "LessThanOrEqual" + URLPathOperatorRegEx URLPathOperator = "RegEx" + URLPathOperatorWildcard URLPathOperator = "Wildcard" +) + +func PossibleValuesForURLPathOperator() []string { + return []string{ + string(URLPathOperatorAny), + string(URLPathOperatorBeginsWith), + string(URLPathOperatorContains), + string(URLPathOperatorEndsWith), + string(URLPathOperatorEqual), + string(URLPathOperatorGreaterThan), + string(URLPathOperatorGreaterThanOrEqual), + string(URLPathOperatorLessThan), + string(URLPathOperatorLessThanOrEqual), + string(URLPathOperatorRegEx), + string(URLPathOperatorWildcard), + } +} + +func (s *URLPathOperator) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseURLPathOperator(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseURLPathOperator(input string) (*URLPathOperator, error) { + vals := map[string]URLPathOperator{ + "any": URLPathOperatorAny, + "beginswith": URLPathOperatorBeginsWith, + "contains": URLPathOperatorContains, + "endswith": URLPathOperatorEndsWith, + "equal": URLPathOperatorEqual, + "greaterthan": URLPathOperatorGreaterThan, + "greaterthanorequal": URLPathOperatorGreaterThanOrEqual, + "lessthan": URLPathOperatorLessThan, + "lessthanorequal": URLPathOperatorLessThanOrEqual, + "regex": URLPathOperatorRegEx, + "wildcard": URLPathOperatorWildcard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := URLPathOperator(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_rule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_rule.go new file mode 100644 index 000000000000..82e145de4595 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_rule.go @@ -0,0 +1,148 @@ +package rules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&RuleId{}) +} + +var _ resourceids.ResourceId = &RuleId{} + +// RuleId is a struct representing the Resource ID for a Rule +type RuleId struct { + SubscriptionId string + ResourceGroupName string + ProfileName string + RuleSetName string + RuleName string +} + +// NewRuleID returns a new RuleId struct +func NewRuleID(subscriptionId string, resourceGroupName string, profileName string, ruleSetName string, ruleName string) RuleId { + return RuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProfileName: profileName, + RuleSetName: ruleSetName, + RuleName: ruleName, + } +} + +// ParseRuleID parses 'input' into a RuleId +func ParseRuleID(input string) (*RuleId, error) { + parser := resourceids.NewParserFromResourceIdType(&RuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RuleId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRuleIDInsensitively parses 'input' case-insensitively into a RuleId +// note: this method should only be used for API response data and not user input +func ParseRuleIDInsensitively(input string) (*RuleId, error) { + parser := resourceids.NewParserFromResourceIdType(&RuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RuleId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ProfileName, ok = input.Parsed["profileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "profileName", input) + } + + if id.RuleSetName, ok = input.Parsed["ruleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleSetName", input) + } + + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) + } + + return nil +} + +// ValidateRuleID checks that 'input' can be parsed as a Rule ID +func ValidateRuleID(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 := ParseRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Rule ID +func (id RuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/ruleSets/%s/rules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName, id.RuleSetName, id.RuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Rule ID +func (id RuleId) 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("staticMicrosoftCdn", "Microsoft.Cdn", "Microsoft.Cdn"), + resourceids.StaticSegment("staticProfiles", "profiles", "profiles"), + resourceids.UserSpecifiedSegment("profileName", "profileName"), + resourceids.StaticSegment("staticRuleSets", "ruleSets", "ruleSets"), + resourceids.UserSpecifiedSegment("ruleSetName", "ruleSetName"), + resourceids.StaticSegment("staticRules", "rules", "rules"), + resourceids.UserSpecifiedSegment("ruleName", "ruleName"), + } +} + +// String returns a human-readable description of this Rule ID +func (id RuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Profile Name: %q", id.ProfileName), + fmt.Sprintf("Rule Set Name: %q", id.RuleSetName), + fmt.Sprintf("Rule Name: %q", id.RuleName), + } + return fmt.Sprintf("Rule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_ruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_ruleset.go new file mode 100644 index 000000000000..c477a9f4e744 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_ruleset.go @@ -0,0 +1,139 @@ +package rules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&RuleSetId{}) +} + +var _ resourceids.ResourceId = &RuleSetId{} + +// RuleSetId is a struct representing the Resource ID for a Rule Set +type RuleSetId struct { + SubscriptionId string + ResourceGroupName string + ProfileName string + RuleSetName string +} + +// NewRuleSetID returns a new RuleSetId struct +func NewRuleSetID(subscriptionId string, resourceGroupName string, profileName string, ruleSetName string) RuleSetId { + return RuleSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProfileName: profileName, + RuleSetName: ruleSetName, + } +} + +// ParseRuleSetID parses 'input' into a RuleSetId +func ParseRuleSetID(input string) (*RuleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&RuleSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RuleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRuleSetIDInsensitively parses 'input' case-insensitively into a RuleSetId +// note: this method should only be used for API response data and not user input +func ParseRuleSetIDInsensitively(input string) (*RuleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&RuleSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RuleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RuleSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ProfileName, ok = input.Parsed["profileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "profileName", input) + } + + if id.RuleSetName, ok = input.Parsed["ruleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleSetName", input) + } + + return nil +} + +// ValidateRuleSetID checks that 'input' can be parsed as a Rule Set ID +func ValidateRuleSetID(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 := ParseRuleSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Rule Set ID +func (id RuleSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/ruleSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName, id.RuleSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Rule Set ID +func (id RuleSetId) 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("staticMicrosoftCdn", "Microsoft.Cdn", "Microsoft.Cdn"), + resourceids.StaticSegment("staticProfiles", "profiles", "profiles"), + resourceids.UserSpecifiedSegment("profileName", "profileName"), + resourceids.StaticSegment("staticRuleSets", "ruleSets", "ruleSets"), + resourceids.UserSpecifiedSegment("ruleSetName", "ruleSetName"), + } +} + +// String returns a human-readable description of this Rule Set ID +func (id RuleSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Profile Name: %q", id.ProfileName), + fmt.Sprintf("Rule Set Name: %q", id.RuleSetName), + } + return fmt.Sprintf("Rule Set (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_create.go new file mode 100644 index 000000000000..84a6f02dc5e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_create.go @@ -0,0 +1,76 @@ +package rules + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Rule +} + +// Create ... +func (c RulesClient) Create(ctx context.Context, id RuleId, input Rule) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c RulesClient) CreateThenPoll(ctx context.Context, id RuleId, input Rule) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_delete.go new file mode 100644 index 000000000000..beb0bc70b2ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_delete.go @@ -0,0 +1,71 @@ +package rules + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c RulesClient) Delete(ctx context.Context, id RuleId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c RulesClient) DeleteThenPoll(ctx context.Context, id RuleId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_get.go new file mode 100644 index 000000000000..fb626b44bac0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_get.go @@ -0,0 +1,53 @@ +package rules + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *Rule +} + +// Get ... +func (c RulesClient) Get(ctx context.Context, id RuleId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Rule + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_listbyruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_listbyruleset.go new file mode 100644 index 000000000000..45074b4d0143 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_listbyruleset.go @@ -0,0 +1,105 @@ +package rules + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByRuleSetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Rule +} + +type ListByRuleSetCompleteResult struct { + LatestHttpResponse *http.Response + Items []Rule +} + +type ListByRuleSetCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByRuleSetCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByRuleSet ... +func (c RulesClient) ListByRuleSet(ctx context.Context, id RuleSetId) (result ListByRuleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByRuleSetCustomPager{}, + Path: fmt.Sprintf("%s/rules", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Rule `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByRuleSetComplete retrieves all the results into a single object +func (c RulesClient) ListByRuleSetComplete(ctx context.Context, id RuleSetId) (ListByRuleSetCompleteResult, error) { + return c.ListByRuleSetCompleteMatchingPredicate(ctx, id, RuleOperationPredicate{}) +} + +// ListByRuleSetCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RulesClient) ListByRuleSetCompleteMatchingPredicate(ctx context.Context, id RuleSetId, predicate RuleOperationPredicate) (result ListByRuleSetCompleteResult, err error) { + items := make([]Rule, 0) + + resp, err := c.ListByRuleSet(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByRuleSetCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_update.go new file mode 100644 index 000000000000..1d7a1bd0f418 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_update.go @@ -0,0 +1,75 @@ +package rules + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Rule +} + +// Update ... +func (c RulesClient) Update(ctx context.Context, id RuleId, input RuleUpdateParameters) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c RulesClient) UpdateThenPoll(ctx context.Context, id RuleId, input RuleUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheconfiguration.go new file mode 100644 index 000000000000..af68de873acf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheconfiguration.go @@ -0,0 +1,12 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CacheConfiguration struct { + CacheBehavior *RuleCacheBehavior `json:"cacheBehavior,omitempty"` + CacheDuration *string `json:"cacheDuration,omitempty"` + IsCompressionEnabled *RuleIsCompressionEnabled `json:"isCompressionEnabled,omitempty"` + QueryParameters *string `json:"queryParameters,omitempty"` + QueryStringCachingBehavior *RuleQueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheexpirationactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheexpirationactionparameters.go new file mode 100644 index 000000000000..77c5d8d30821 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheexpirationactionparameters.go @@ -0,0 +1,52 @@ +package rules + +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 _ DeliveryRuleActionParameters = CacheExpirationActionParameters{} + +type CacheExpirationActionParameters struct { + CacheBehavior CacheBehavior `json:"cacheBehavior"` + CacheDuration *string `json:"cacheDuration,omitempty"` + CacheType CacheType `json:"cacheType"` + + // Fields inherited from DeliveryRuleActionParameters + + TypeName DeliveryRuleActionParametersType `json:"typeName"` +} + +func (s CacheExpirationActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return BaseDeliveryRuleActionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = CacheExpirationActionParameters{} + +func (s CacheExpirationActionParameters) MarshalJSON() ([]byte, error) { + type wrapper CacheExpirationActionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CacheExpirationActionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CacheExpirationActionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleCacheExpirationActionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CacheExpirationActionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cachekeyquerystringactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cachekeyquerystringactionparameters.go new file mode 100644 index 000000000000..b552b31226e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cachekeyquerystringactionparameters.go @@ -0,0 +1,51 @@ +package rules + +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 _ DeliveryRuleActionParameters = CacheKeyQueryStringActionParameters{} + +type CacheKeyQueryStringActionParameters struct { + QueryParameters *string `json:"queryParameters,omitempty"` + QueryStringBehavior QueryStringBehavior `json:"queryStringBehavior"` + + // Fields inherited from DeliveryRuleActionParameters + + TypeName DeliveryRuleActionParametersType `json:"typeName"` +} + +func (s CacheKeyQueryStringActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return BaseDeliveryRuleActionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = CacheKeyQueryStringActionParameters{} + +func (s CacheKeyQueryStringActionParameters) MarshalJSON() ([]byte, error) { + type wrapper CacheKeyQueryStringActionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CacheKeyQueryStringActionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CacheKeyQueryStringActionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CacheKeyQueryStringActionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_clientportmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_clientportmatchconditionparameters.go new file mode 100644 index 000000000000..f989d7c03140 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_clientportmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = ClientPortMatchConditionParameters{} + +type ClientPortMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator ClientPortOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s ClientPortMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = ClientPortMatchConditionParameters{} + +func (s ClientPortMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper ClientPortMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ClientPortMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ClientPortMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleClientPortConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ClientPortMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cookiesmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cookiesmatchconditionparameters.go new file mode 100644 index 000000000000..63296e5671a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cookiesmatchconditionparameters.go @@ -0,0 +1,54 @@ +package rules + +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 _ DeliveryRuleConditionParameters = CookiesMatchConditionParameters{} + +type CookiesMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator CookiesOperator `json:"operator"` + Selector *string `json:"selector,omitempty"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s CookiesMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = CookiesMatchConditionParameters{} + +func (s CookiesMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper CookiesMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CookiesMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CookiesMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleCookiesConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CookiesMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleaction.go new file mode 100644 index 000000000000..c9742f9ceb76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleaction.go @@ -0,0 +1,139 @@ +package rules + +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 DeliveryRuleAction interface { + DeliveryRuleAction() BaseDeliveryRuleActionImpl +} + +var _ DeliveryRuleAction = BaseDeliveryRuleActionImpl{} + +type BaseDeliveryRuleActionImpl struct { + Name DeliveryRuleActionName `json:"name"` +} + +func (s BaseDeliveryRuleActionImpl) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return s +} + +var _ DeliveryRuleAction = RawDeliveryRuleActionImpl{} + +// RawDeliveryRuleActionImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawDeliveryRuleActionImpl struct { + deliveryRuleAction BaseDeliveryRuleActionImpl + Type string + Values map[string]interface{} +} + +func (s RawDeliveryRuleActionImpl) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return s.deliveryRuleAction +} + +func UnmarshalDeliveryRuleActionImplementation(input []byte) (DeliveryRuleAction, 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 DeliveryRuleAction into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["name"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "CacheExpiration") { + var out DeliveryRuleCacheExpirationAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleCacheExpirationAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "CacheKeyQueryString") { + var out DeliveryRuleCacheKeyQueryStringAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleCacheKeyQueryStringAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ModifyRequestHeader") { + var out DeliveryRuleRequestHeaderAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestHeaderAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ModifyResponseHeader") { + var out DeliveryRuleResponseHeaderAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleResponseHeaderAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RouteConfigurationOverride") { + var out DeliveryRuleRouteConfigurationOverrideAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleRouteConfigurationOverrideAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "OriginGroupOverride") { + var out OriginGroupOverrideAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into OriginGroupOverrideAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "UrlRedirect") { + var out URLRedirectAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into URLRedirectAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "UrlRewrite") { + var out URLRewriteAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into URLRewriteAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "UrlSigning") { + var out URLSigningAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into URLSigningAction: %+v", err) + } + return out, nil + } + + var parent BaseDeliveryRuleActionImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseDeliveryRuleActionImpl: %+v", err) + } + + return RawDeliveryRuleActionImpl{ + deliveryRuleAction: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleactionparameters.go new file mode 100644 index 000000000000..f6a9cc5b1c63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleactionparameters.go @@ -0,0 +1,131 @@ +package rules + +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 DeliveryRuleActionParameters interface { + DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl +} + +var _ DeliveryRuleActionParameters = BaseDeliveryRuleActionParametersImpl{} + +type BaseDeliveryRuleActionParametersImpl struct { + TypeName DeliveryRuleActionParametersType `json:"typeName"` +} + +func (s BaseDeliveryRuleActionParametersImpl) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return s +} + +var _ DeliveryRuleActionParameters = RawDeliveryRuleActionParametersImpl{} + +// RawDeliveryRuleActionParametersImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawDeliveryRuleActionParametersImpl struct { + deliveryRuleActionParameters BaseDeliveryRuleActionParametersImpl + Type string + Values map[string]interface{} +} + +func (s RawDeliveryRuleActionParametersImpl) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return s.deliveryRuleActionParameters +} + +func UnmarshalDeliveryRuleActionParametersImplementation(input []byte) (DeliveryRuleActionParameters, 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 DeliveryRuleActionParameters into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["typeName"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "DeliveryRuleCacheExpirationActionParameters") { + var out CacheExpirationActionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CacheExpirationActionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters") { + var out CacheKeyQueryStringActionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CacheKeyQueryStringActionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleHeaderActionParameters") { + var out HeaderActionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into HeaderActionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleOriginGroupOverrideActionParameters") { + var out OriginGroupOverrideActionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into OriginGroupOverrideActionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleRouteConfigurationOverrideActionParameters") { + var out RouteConfigurationOverrideActionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RouteConfigurationOverrideActionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleUrlRedirectActionParameters") { + var out URLRedirectActionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into URLRedirectActionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleUrlRewriteActionParameters") { + var out URLRewriteActionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into URLRewriteActionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleUrlSigningActionParameters") { + var out URLSigningActionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into URLSigningActionParameters: %+v", err) + } + return out, nil + } + + var parent BaseDeliveryRuleActionParametersImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseDeliveryRuleActionParametersImpl: %+v", err) + } + + return RawDeliveryRuleActionParametersImpl{ + deliveryRuleActionParameters: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecacheexpirationaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecacheexpirationaction.go new file mode 100644 index 000000000000..2106d68c5436 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecacheexpirationaction.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleAction = DeliveryRuleCacheExpirationAction{} + +type DeliveryRuleCacheExpirationAction struct { + Parameters CacheExpirationActionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleAction + + Name DeliveryRuleActionName `json:"name"` +} + +func (s DeliveryRuleCacheExpirationAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return BaseDeliveryRuleActionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleCacheExpirationAction{} + +func (s DeliveryRuleCacheExpirationAction) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleCacheExpirationAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleCacheExpirationAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleCacheExpirationAction: %+v", err) + } + + decoded["name"] = "CacheExpiration" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleCacheExpirationAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecachekeyquerystringaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecachekeyquerystringaction.go new file mode 100644 index 000000000000..db7fa3798f67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecachekeyquerystringaction.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleAction = DeliveryRuleCacheKeyQueryStringAction{} + +type DeliveryRuleCacheKeyQueryStringAction struct { + Parameters CacheKeyQueryStringActionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleAction + + Name DeliveryRuleActionName `json:"name"` +} + +func (s DeliveryRuleCacheKeyQueryStringAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return BaseDeliveryRuleActionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleCacheKeyQueryStringAction{} + +func (s DeliveryRuleCacheKeyQueryStringAction) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleCacheKeyQueryStringAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleCacheKeyQueryStringAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleCacheKeyQueryStringAction: %+v", err) + } + + decoded["name"] = "CacheKeyQueryString" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleCacheKeyQueryStringAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleclientportcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleclientportcondition.go new file mode 100644 index 000000000000..c825b6620918 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleclientportcondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleClientPortCondition{} + +type DeliveryRuleClientPortCondition struct { + Parameters ClientPortMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleClientPortCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleClientPortCondition{} + +func (s DeliveryRuleClientPortCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleClientPortCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleClientPortCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleClientPortCondition: %+v", err) + } + + decoded["name"] = "ClientPort" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleClientPortCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecondition.go new file mode 100644 index 000000000000..f82db88bf3ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecondition.go @@ -0,0 +1,219 @@ +package rules + +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 DeliveryRuleCondition interface { + DeliveryRuleCondition() BaseDeliveryRuleConditionImpl +} + +var _ DeliveryRuleCondition = BaseDeliveryRuleConditionImpl{} + +type BaseDeliveryRuleConditionImpl struct { + Name MatchVariable `json:"name"` +} + +func (s BaseDeliveryRuleConditionImpl) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return s +} + +var _ DeliveryRuleCondition = RawDeliveryRuleConditionImpl{} + +// RawDeliveryRuleConditionImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawDeliveryRuleConditionImpl struct { + deliveryRuleCondition BaseDeliveryRuleConditionImpl + Type string + Values map[string]interface{} +} + +func (s RawDeliveryRuleConditionImpl) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return s.deliveryRuleCondition +} + +func UnmarshalDeliveryRuleConditionImplementation(input []byte) (DeliveryRuleCondition, 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 DeliveryRuleCondition into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["name"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "ClientPort") { + var out DeliveryRuleClientPortCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleClientPortCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Cookies") { + var out DeliveryRuleCookiesCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleCookiesCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "HttpVersion") { + var out DeliveryRuleHTTPVersionCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleHTTPVersionCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "HostName") { + var out DeliveryRuleHostNameCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleHostNameCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "IsDevice") { + var out DeliveryRuleIsDeviceCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleIsDeviceCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "PostArgs") { + var out DeliveryRulePostArgsCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRulePostArgsCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "QueryString") { + var out DeliveryRuleQueryStringCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleQueryStringCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RemoteAddress") { + var out DeliveryRuleRemoteAddressCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleRemoteAddressCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RequestBody") { + var out DeliveryRuleRequestBodyCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestBodyCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RequestHeader") { + var out DeliveryRuleRequestHeaderCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestHeaderCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RequestMethod") { + var out DeliveryRuleRequestMethodCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestMethodCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RequestScheme") { + var out DeliveryRuleRequestSchemeCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestSchemeCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RequestUri") { + var out DeliveryRuleRequestUriCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestUriCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ServerPort") { + var out DeliveryRuleServerPortCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleServerPortCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "SocketAddr") { + var out DeliveryRuleSocketAddrCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleSocketAddrCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "SslProtocol") { + var out DeliveryRuleSslProtocolCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleSslProtocolCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "UrlFileExtension") { + var out DeliveryRuleURLFileExtensionCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleURLFileExtensionCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "UrlFileName") { + var out DeliveryRuleURLFileNameCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleURLFileNameCondition: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "UrlPath") { + var out DeliveryRuleURLPathCondition + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeliveryRuleURLPathCondition: %+v", err) + } + return out, nil + } + + var parent BaseDeliveryRuleConditionImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseDeliveryRuleConditionImpl: %+v", err) + } + + return RawDeliveryRuleConditionImpl{ + deliveryRuleCondition: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleconditionparameters.go new file mode 100644 index 000000000000..f527b6e7326c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleconditionparameters.go @@ -0,0 +1,219 @@ +package rules + +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 DeliveryRuleConditionParameters interface { + DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl +} + +var _ DeliveryRuleConditionParameters = BaseDeliveryRuleConditionParametersImpl{} + +type BaseDeliveryRuleConditionParametersImpl struct { + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s BaseDeliveryRuleConditionParametersImpl) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return s +} + +var _ DeliveryRuleConditionParameters = RawDeliveryRuleConditionParametersImpl{} + +// RawDeliveryRuleConditionParametersImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawDeliveryRuleConditionParametersImpl struct { + deliveryRuleConditionParameters BaseDeliveryRuleConditionParametersImpl + Type string + Values map[string]interface{} +} + +func (s RawDeliveryRuleConditionParametersImpl) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return s.deliveryRuleConditionParameters +} + +func UnmarshalDeliveryRuleConditionParametersImplementation(input []byte) (DeliveryRuleConditionParameters, 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 DeliveryRuleConditionParameters into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["typeName"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "DeliveryRuleClientPortConditionParameters") { + var out ClientPortMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ClientPortMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleCookiesConditionParameters") { + var out CookiesMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CookiesMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleHttpVersionConditionParameters") { + var out HTTPVersionMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into HTTPVersionMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleHostNameConditionParameters") { + var out HostNameMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into HostNameMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleIsDeviceConditionParameters") { + var out IsDeviceMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into IsDeviceMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRulePostArgsConditionParameters") { + var out PostArgsMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into PostArgsMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleQueryStringConditionParameters") { + var out QueryStringMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into QueryStringMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleRemoteAddressConditionParameters") { + var out RemoteAddressMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RemoteAddressMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleRequestBodyConditionParameters") { + var out RequestBodyMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RequestBodyMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleRequestHeaderConditionParameters") { + var out RequestHeaderMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RequestHeaderMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleRequestMethodConditionParameters") { + var out RequestMethodMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RequestMethodMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleRequestSchemeConditionParameters") { + var out RequestSchemeMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RequestSchemeMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleRequestUriConditionParameters") { + var out RequestUriMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RequestUriMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleServerPortConditionParameters") { + var out ServerPortMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPortMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleSocketAddrConditionParameters") { + var out SocketAddrMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SocketAddrMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleSslProtocolConditionParameters") { + var out SslProtocolMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SslProtocolMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleUrlFileExtensionMatchConditionParameters") { + var out URLFileExtensionMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into URLFileExtensionMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleUrlFilenameConditionParameters") { + var out URLFileNameMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into URLFileNameMatchConditionParameters: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeliveryRuleUrlPathMatchConditionParameters") { + var out URLPathMatchConditionParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into URLPathMatchConditionParameters: %+v", err) + } + return out, nil + } + + var parent BaseDeliveryRuleConditionParametersImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseDeliveryRuleConditionParametersImpl: %+v", err) + } + + return RawDeliveryRuleConditionParametersImpl{ + deliveryRuleConditionParameters: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecookiescondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecookiescondition.go new file mode 100644 index 000000000000..e76520b53a28 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecookiescondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleCookiesCondition{} + +type DeliveryRuleCookiesCondition struct { + Parameters CookiesMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleCookiesCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleCookiesCondition{} + +func (s DeliveryRuleCookiesCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleCookiesCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleCookiesCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleCookiesCondition: %+v", err) + } + + decoded["name"] = "Cookies" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleCookiesCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehostnamecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehostnamecondition.go new file mode 100644 index 000000000000..44ef6b50c1ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehostnamecondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleHostNameCondition{} + +type DeliveryRuleHostNameCondition struct { + Parameters HostNameMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleHostNameCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleHostNameCondition{} + +func (s DeliveryRuleHostNameCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleHostNameCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleHostNameCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleHostNameCondition: %+v", err) + } + + decoded["name"] = "HostName" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleHostNameCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehttpversioncondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehttpversioncondition.go new file mode 100644 index 000000000000..aa27793fbf21 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehttpversioncondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleHTTPVersionCondition{} + +type DeliveryRuleHTTPVersionCondition struct { + Parameters HTTPVersionMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleHTTPVersionCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleHTTPVersionCondition{} + +func (s DeliveryRuleHTTPVersionCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleHTTPVersionCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleHTTPVersionCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleHTTPVersionCondition: %+v", err) + } + + decoded["name"] = "HttpVersion" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleHTTPVersionCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleisdevicecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleisdevicecondition.go new file mode 100644 index 000000000000..5ae76aaa26aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleisdevicecondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleIsDeviceCondition{} + +type DeliveryRuleIsDeviceCondition struct { + Parameters IsDeviceMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleIsDeviceCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleIsDeviceCondition{} + +func (s DeliveryRuleIsDeviceCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleIsDeviceCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleIsDeviceCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleIsDeviceCondition: %+v", err) + } + + decoded["name"] = "IsDevice" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleIsDeviceCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulepostargscondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulepostargscondition.go new file mode 100644 index 000000000000..0b549f2b27b7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulepostargscondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRulePostArgsCondition{} + +type DeliveryRulePostArgsCondition struct { + Parameters PostArgsMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRulePostArgsCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRulePostArgsCondition{} + +func (s DeliveryRulePostArgsCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRulePostArgsCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRulePostArgsCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRulePostArgsCondition: %+v", err) + } + + decoded["name"] = "PostArgs" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRulePostArgsCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulequerystringcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulequerystringcondition.go new file mode 100644 index 000000000000..8e147deab21d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulequerystringcondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleQueryStringCondition{} + +type DeliveryRuleQueryStringCondition struct { + Parameters QueryStringMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleQueryStringCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleQueryStringCondition{} + +func (s DeliveryRuleQueryStringCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleQueryStringCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleQueryStringCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleQueryStringCondition: %+v", err) + } + + decoded["name"] = "QueryString" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleQueryStringCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleremoteaddresscondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleremoteaddresscondition.go new file mode 100644 index 000000000000..82eb3b6165d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleremoteaddresscondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleRemoteAddressCondition{} + +type DeliveryRuleRemoteAddressCondition struct { + Parameters RemoteAddressMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleRemoteAddressCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleRemoteAddressCondition{} + +func (s DeliveryRuleRemoteAddressCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleRemoteAddressCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleRemoteAddressCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleRemoteAddressCondition: %+v", err) + } + + decoded["name"] = "RemoteAddress" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleRemoteAddressCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestbodycondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestbodycondition.go new file mode 100644 index 000000000000..4a7ed969fdcd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestbodycondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleRequestBodyCondition{} + +type DeliveryRuleRequestBodyCondition struct { + Parameters RequestBodyMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleRequestBodyCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleRequestBodyCondition{} + +func (s DeliveryRuleRequestBodyCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleRequestBodyCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleRequestBodyCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestBodyCondition: %+v", err) + } + + decoded["name"] = "RequestBody" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestBodyCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheaderaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheaderaction.go new file mode 100644 index 000000000000..0b4b70c1c740 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheaderaction.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleAction = DeliveryRuleRequestHeaderAction{} + +type DeliveryRuleRequestHeaderAction struct { + Parameters HeaderActionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleAction + + Name DeliveryRuleActionName `json:"name"` +} + +func (s DeliveryRuleRequestHeaderAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return BaseDeliveryRuleActionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleRequestHeaderAction{} + +func (s DeliveryRuleRequestHeaderAction) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleRequestHeaderAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleRequestHeaderAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestHeaderAction: %+v", err) + } + + decoded["name"] = "ModifyRequestHeader" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestHeaderAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheadercondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheadercondition.go new file mode 100644 index 000000000000..f1d34dc0f764 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheadercondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleRequestHeaderCondition{} + +type DeliveryRuleRequestHeaderCondition struct { + Parameters RequestHeaderMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleRequestHeaderCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleRequestHeaderCondition{} + +func (s DeliveryRuleRequestHeaderCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleRequestHeaderCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleRequestHeaderCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestHeaderCondition: %+v", err) + } + + decoded["name"] = "RequestHeader" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestHeaderCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestmethodcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestmethodcondition.go new file mode 100644 index 000000000000..3ce8ced0d673 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestmethodcondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleRequestMethodCondition{} + +type DeliveryRuleRequestMethodCondition struct { + Parameters RequestMethodMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleRequestMethodCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleRequestMethodCondition{} + +func (s DeliveryRuleRequestMethodCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleRequestMethodCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleRequestMethodCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestMethodCondition: %+v", err) + } + + decoded["name"] = "RequestMethod" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestMethodCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestschemecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestschemecondition.go new file mode 100644 index 000000000000..1af6289b7f06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestschemecondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleRequestSchemeCondition{} + +type DeliveryRuleRequestSchemeCondition struct { + Parameters RequestSchemeMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleRequestSchemeCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleRequestSchemeCondition{} + +func (s DeliveryRuleRequestSchemeCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleRequestSchemeCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleRequestSchemeCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestSchemeCondition: %+v", err) + } + + decoded["name"] = "RequestScheme" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestSchemeCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequesturicondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequesturicondition.go new file mode 100644 index 000000000000..63335243168b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequesturicondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleRequestUriCondition{} + +type DeliveryRuleRequestUriCondition struct { + Parameters RequestUriMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleRequestUriCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleRequestUriCondition{} + +func (s DeliveryRuleRequestUriCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleRequestUriCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleRequestUriCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestUriCondition: %+v", err) + } + + decoded["name"] = "RequestUri" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestUriCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleresponseheaderaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleresponseheaderaction.go new file mode 100644 index 000000000000..264c599d00ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleresponseheaderaction.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleAction = DeliveryRuleResponseHeaderAction{} + +type DeliveryRuleResponseHeaderAction struct { + Parameters HeaderActionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleAction + + Name DeliveryRuleActionName `json:"name"` +} + +func (s DeliveryRuleResponseHeaderAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return BaseDeliveryRuleActionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleResponseHeaderAction{} + +func (s DeliveryRuleResponseHeaderAction) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleResponseHeaderAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleResponseHeaderAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleResponseHeaderAction: %+v", err) + } + + decoded["name"] = "ModifyResponseHeader" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleResponseHeaderAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go new file mode 100644 index 000000000000..5aed6e8f9dc4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleAction = DeliveryRuleRouteConfigurationOverrideAction{} + +type DeliveryRuleRouteConfigurationOverrideAction struct { + Parameters RouteConfigurationOverrideActionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleAction + + Name DeliveryRuleActionName `json:"name"` +} + +func (s DeliveryRuleRouteConfigurationOverrideAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return BaseDeliveryRuleActionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleRouteConfigurationOverrideAction{} + +func (s DeliveryRuleRouteConfigurationOverrideAction) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleRouteConfigurationOverrideAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleRouteConfigurationOverrideAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleRouteConfigurationOverrideAction: %+v", err) + } + + decoded["name"] = "RouteConfigurationOverride" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleRouteConfigurationOverrideAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleserverportcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleserverportcondition.go new file mode 100644 index 000000000000..ce4318a26d08 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleserverportcondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleServerPortCondition{} + +type DeliveryRuleServerPortCondition struct { + Parameters ServerPortMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleServerPortCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleServerPortCondition{} + +func (s DeliveryRuleServerPortCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleServerPortCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleServerPortCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleServerPortCondition: %+v", err) + } + + decoded["name"] = "ServerPort" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleServerPortCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesocketaddrcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesocketaddrcondition.go new file mode 100644 index 000000000000..e7fab395f439 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesocketaddrcondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleSocketAddrCondition{} + +type DeliveryRuleSocketAddrCondition struct { + Parameters SocketAddrMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleSocketAddrCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleSocketAddrCondition{} + +func (s DeliveryRuleSocketAddrCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleSocketAddrCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleSocketAddrCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleSocketAddrCondition: %+v", err) + } + + decoded["name"] = "SocketAddr" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleSocketAddrCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesslprotocolcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesslprotocolcondition.go new file mode 100644 index 000000000000..7ab504fa0544 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesslprotocolcondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleSslProtocolCondition{} + +type DeliveryRuleSslProtocolCondition struct { + Parameters SslProtocolMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleSslProtocolCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleSslProtocolCondition{} + +func (s DeliveryRuleSslProtocolCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleSslProtocolCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleSslProtocolCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleSslProtocolCondition: %+v", err) + } + + decoded["name"] = "SslProtocol" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleSslProtocolCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfileextensioncondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfileextensioncondition.go new file mode 100644 index 000000000000..1654163eb0d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfileextensioncondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleURLFileExtensionCondition{} + +type DeliveryRuleURLFileExtensionCondition struct { + Parameters URLFileExtensionMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleURLFileExtensionCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleURLFileExtensionCondition{} + +func (s DeliveryRuleURLFileExtensionCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleURLFileExtensionCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleURLFileExtensionCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleURLFileExtensionCondition: %+v", err) + } + + decoded["name"] = "UrlFileExtension" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleURLFileExtensionCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfilenamecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfilenamecondition.go new file mode 100644 index 000000000000..c2e66c272547 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfilenamecondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleURLFileNameCondition{} + +type DeliveryRuleURLFileNameCondition struct { + Parameters URLFileNameMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleURLFileNameCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleURLFileNameCondition{} + +func (s DeliveryRuleURLFileNameCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleURLFileNameCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleURLFileNameCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleURLFileNameCondition: %+v", err) + } + + decoded["name"] = "UrlFileName" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleURLFileNameCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlpathcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlpathcondition.go new file mode 100644 index 000000000000..f88fc78d5b0d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlpathcondition.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleCondition = DeliveryRuleURLPathCondition{} + +type DeliveryRuleURLPathCondition struct { + Parameters URLPathMatchConditionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleCondition + + Name MatchVariable `json:"name"` +} + +func (s DeliveryRuleURLPathCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { + return BaseDeliveryRuleConditionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = DeliveryRuleURLPathCondition{} + +func (s DeliveryRuleURLPathCondition) MarshalJSON() ([]byte, error) { + type wrapper DeliveryRuleURLPathCondition + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeliveryRuleURLPathCondition: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeliveryRuleURLPathCondition: %+v", err) + } + + decoded["name"] = "UrlPath" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeliveryRuleURLPathCondition: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_headeractionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_headeractionparameters.go new file mode 100644 index 000000000000..6bf4a05fded9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_headeractionparameters.go @@ -0,0 +1,52 @@ +package rules + +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 _ DeliveryRuleActionParameters = HeaderActionParameters{} + +type HeaderActionParameters struct { + HeaderAction HeaderAction `json:"headerAction"` + HeaderName string `json:"headerName"` + Value *string `json:"value,omitempty"` + + // Fields inherited from DeliveryRuleActionParameters + + TypeName DeliveryRuleActionParametersType `json:"typeName"` +} + +func (s HeaderActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return BaseDeliveryRuleActionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = HeaderActionParameters{} + +func (s HeaderActionParameters) MarshalJSON() ([]byte, error) { + type wrapper HeaderActionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling HeaderActionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling HeaderActionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleHeaderActionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling HeaderActionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_hostnamematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_hostnamematchconditionparameters.go new file mode 100644 index 000000000000..9dde99c7f84f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_hostnamematchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = HostNameMatchConditionParameters{} + +type HostNameMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator HostNameOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s HostNameMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = HostNameMatchConditionParameters{} + +func (s HostNameMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper HostNameMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling HostNameMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling HostNameMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleHostNameConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling HostNameMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_httpversionmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_httpversionmatchconditionparameters.go new file mode 100644 index 000000000000..4fdfdc7344d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_httpversionmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = HTTPVersionMatchConditionParameters{} + +type HTTPVersionMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator HTTPVersionOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s HTTPVersionMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = HTTPVersionMatchConditionParameters{} + +func (s HTTPVersionMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper HTTPVersionMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling HTTPVersionMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling HTTPVersionMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleHttpVersionConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling HTTPVersionMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_isdevicematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_isdevicematchconditionparameters.go new file mode 100644 index 000000000000..f3b7e28c6bce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_isdevicematchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = IsDeviceMatchConditionParameters{} + +type IsDeviceMatchConditionParameters struct { + MatchValues *[]IsDeviceMatchValue `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator IsDeviceOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s IsDeviceMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = IsDeviceMatchConditionParameters{} + +func (s IsDeviceMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper IsDeviceMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling IsDeviceMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling IsDeviceMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleIsDeviceConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling IsDeviceMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverride.go new file mode 100644 index 000000000000..72d2e00784bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverride.go @@ -0,0 +1,9 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OriginGroupOverride struct { + ForwardingProtocol *ForwardingProtocol `json:"forwardingProtocol,omitempty"` + OriginGroup *ResourceReference `json:"originGroup,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideaction.go new file mode 100644 index 000000000000..d7ed168c94c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideaction.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleAction = OriginGroupOverrideAction{} + +type OriginGroupOverrideAction struct { + Parameters OriginGroupOverrideActionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleAction + + Name DeliveryRuleActionName `json:"name"` +} + +func (s OriginGroupOverrideAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return BaseDeliveryRuleActionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = OriginGroupOverrideAction{} + +func (s OriginGroupOverrideAction) MarshalJSON() ([]byte, error) { + type wrapper OriginGroupOverrideAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling OriginGroupOverrideAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling OriginGroupOverrideAction: %+v", err) + } + + decoded["name"] = "OriginGroupOverride" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling OriginGroupOverrideAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideactionparameters.go new file mode 100644 index 000000000000..138ece4ddeae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideactionparameters.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleActionParameters = OriginGroupOverrideActionParameters{} + +type OriginGroupOverrideActionParameters struct { + OriginGroup ResourceReference `json:"originGroup"` + + // Fields inherited from DeliveryRuleActionParameters + + TypeName DeliveryRuleActionParametersType `json:"typeName"` +} + +func (s OriginGroupOverrideActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return BaseDeliveryRuleActionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = OriginGroupOverrideActionParameters{} + +func (s OriginGroupOverrideActionParameters) MarshalJSON() ([]byte, error) { + type wrapper OriginGroupOverrideActionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling OriginGroupOverrideActionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling OriginGroupOverrideActionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleOriginGroupOverrideActionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling OriginGroupOverrideActionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_postargsmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_postargsmatchconditionparameters.go new file mode 100644 index 000000000000..3943de4a654e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_postargsmatchconditionparameters.go @@ -0,0 +1,54 @@ +package rules + +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 _ DeliveryRuleConditionParameters = PostArgsMatchConditionParameters{} + +type PostArgsMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator PostArgsOperator `json:"operator"` + Selector *string `json:"selector,omitempty"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s PostArgsMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = PostArgsMatchConditionParameters{} + +func (s PostArgsMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper PostArgsMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling PostArgsMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling PostArgsMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRulePostArgsConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling PostArgsMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_querystringmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_querystringmatchconditionparameters.go new file mode 100644 index 000000000000..6e8d907688bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_querystringmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = QueryStringMatchConditionParameters{} + +type QueryStringMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator QueryStringOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s QueryStringMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = QueryStringMatchConditionParameters{} + +func (s QueryStringMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper QueryStringMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling QueryStringMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling QueryStringMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleQueryStringConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling QueryStringMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_remoteaddressmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_remoteaddressmatchconditionparameters.go new file mode 100644 index 000000000000..9e91456eb105 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_remoteaddressmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = RemoteAddressMatchConditionParameters{} + +type RemoteAddressMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator RemoteAddressOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s RemoteAddressMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = RemoteAddressMatchConditionParameters{} + +func (s RemoteAddressMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper RemoteAddressMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RemoteAddressMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RemoteAddressMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleRemoteAddressConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RemoteAddressMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestbodymatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestbodymatchconditionparameters.go new file mode 100644 index 000000000000..6264e1db154f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestbodymatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = RequestBodyMatchConditionParameters{} + +type RequestBodyMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator RequestBodyOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s RequestBodyMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = RequestBodyMatchConditionParameters{} + +func (s RequestBodyMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper RequestBodyMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RequestBodyMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RequestBodyMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleRequestBodyConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RequestBodyMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestheadermatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestheadermatchconditionparameters.go new file mode 100644 index 000000000000..8f2ca7a33d86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestheadermatchconditionparameters.go @@ -0,0 +1,54 @@ +package rules + +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 _ DeliveryRuleConditionParameters = RequestHeaderMatchConditionParameters{} + +type RequestHeaderMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator RequestHeaderOperator `json:"operator"` + Selector *string `json:"selector,omitempty"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s RequestHeaderMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = RequestHeaderMatchConditionParameters{} + +func (s RequestHeaderMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper RequestHeaderMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RequestHeaderMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RequestHeaderMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleRequestHeaderConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RequestHeaderMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestmethodmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestmethodmatchconditionparameters.go new file mode 100644 index 000000000000..ea18f9eab27b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestmethodmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = RequestMethodMatchConditionParameters{} + +type RequestMethodMatchConditionParameters struct { + MatchValues *[]RequestMethodMatchValue `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator RequestMethodOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s RequestMethodMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = RequestMethodMatchConditionParameters{} + +func (s RequestMethodMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper RequestMethodMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RequestMethodMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RequestMethodMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleRequestMethodConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RequestMethodMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestschemematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestschemematchconditionparameters.go new file mode 100644 index 000000000000..6e69c0badcec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestschemematchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = RequestSchemeMatchConditionParameters{} + +type RequestSchemeMatchConditionParameters struct { + MatchValues *[]RequestSchemeMatchValue `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator Operator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s RequestSchemeMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = RequestSchemeMatchConditionParameters{} + +func (s RequestSchemeMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper RequestSchemeMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RequestSchemeMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RequestSchemeMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleRequestSchemeConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RequestSchemeMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requesturimatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requesturimatchconditionparameters.go new file mode 100644 index 000000000000..72fcf177b2d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requesturimatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = RequestUriMatchConditionParameters{} + +type RequestUriMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator RequestUriOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s RequestUriMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = RequestUriMatchConditionParameters{} + +func (s RequestUriMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper RequestUriMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RequestUriMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RequestUriMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleRequestUriConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RequestUriMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_resourcereference.go new file mode 100644 index 000000000000..841c18a07708 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_resourcereference.go @@ -0,0 +1,8 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_routeconfigurationoverrideactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_routeconfigurationoverrideactionparameters.go new file mode 100644 index 000000000000..39b23f835a56 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_routeconfigurationoverrideactionparameters.go @@ -0,0 +1,51 @@ +package rules + +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 _ DeliveryRuleActionParameters = RouteConfigurationOverrideActionParameters{} + +type RouteConfigurationOverrideActionParameters struct { + CacheConfiguration *CacheConfiguration `json:"cacheConfiguration,omitempty"` + OriginGroupOverride *OriginGroupOverride `json:"originGroupOverride,omitempty"` + + // Fields inherited from DeliveryRuleActionParameters + + TypeName DeliveryRuleActionParametersType `json:"typeName"` +} + +func (s RouteConfigurationOverrideActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return BaseDeliveryRuleActionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = RouteConfigurationOverrideActionParameters{} + +func (s RouteConfigurationOverrideActionParameters) MarshalJSON() ([]byte, error) { + type wrapper RouteConfigurationOverrideActionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RouteConfigurationOverrideActionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RouteConfigurationOverrideActionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleRouteConfigurationOverrideActionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RouteConfigurationOverrideActionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_rule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_rule.go new file mode 100644 index 000000000000..8b9504ed6008 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_rule.go @@ -0,0 +1,16 @@ +package rules + +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 Rule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RuleProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleproperties.go new file mode 100644 index 000000000000..f9405db82fe5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleproperties.go @@ -0,0 +1,81 @@ +package rules + +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 RuleProperties struct { + Actions *[]DeliveryRuleAction `json:"actions,omitempty"` + Conditions *[]DeliveryRuleCondition `json:"conditions,omitempty"` + DeploymentStatus *DeploymentStatus `json:"deploymentStatus,omitempty"` + MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` + Order *int64 `json:"order,omitempty"` + ProvisioningState *AfdProvisioningState `json:"provisioningState,omitempty"` + RuleSetName *string `json:"ruleSetName,omitempty"` +} + +var _ json.Unmarshaler = &RuleProperties{} + +func (s *RuleProperties) UnmarshalJSON(bytes []byte) error { + var decoded struct { + DeploymentStatus *DeploymentStatus `json:"deploymentStatus,omitempty"` + MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` + Order *int64 `json:"order,omitempty"` + ProvisioningState *AfdProvisioningState `json:"provisioningState,omitempty"` + RuleSetName *string `json:"ruleSetName,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.DeploymentStatus = decoded.DeploymentStatus + s.MatchProcessingBehavior = decoded.MatchProcessingBehavior + s.Order = decoded.Order + s.ProvisioningState = decoded.ProvisioningState + s.RuleSetName = decoded.RuleSetName + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling RuleProperties 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([]DeliveryRuleAction, 0) + for i, val := range listTemp { + impl, err := UnmarshalDeliveryRuleActionImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'Actions' for 'RuleProperties': %+v", i, err) + } + output = append(output, impl) + } + s.Actions = &output + } + + 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([]DeliveryRuleCondition, 0) + for i, val := range listTemp { + impl, err := UnmarshalDeliveryRuleConditionImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'Conditions' for 'RuleProperties': %+v", i, err) + } + output = append(output, impl) + } + s.Conditions = &output + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdateparameters.go new file mode 100644 index 000000000000..d5bd427fc3d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdateparameters.go @@ -0,0 +1,8 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RuleUpdateParameters struct { + Properties *RuleUpdatePropertiesParameters `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdatepropertiesparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdatepropertiesparameters.go new file mode 100644 index 000000000000..3403d24408de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdatepropertiesparameters.go @@ -0,0 +1,75 @@ +package rules + +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 RuleUpdatePropertiesParameters struct { + Actions *[]DeliveryRuleAction `json:"actions,omitempty"` + Conditions *[]DeliveryRuleCondition `json:"conditions,omitempty"` + MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` + Order *int64 `json:"order,omitempty"` + RuleSetName *string `json:"ruleSetName,omitempty"` +} + +var _ json.Unmarshaler = &RuleUpdatePropertiesParameters{} + +func (s *RuleUpdatePropertiesParameters) UnmarshalJSON(bytes []byte) error { + var decoded struct { + MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` + Order *int64 `json:"order,omitempty"` + RuleSetName *string `json:"ruleSetName,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.MatchProcessingBehavior = decoded.MatchProcessingBehavior + s.Order = decoded.Order + s.RuleSetName = decoded.RuleSetName + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling RuleUpdatePropertiesParameters 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([]DeliveryRuleAction, 0) + for i, val := range listTemp { + impl, err := UnmarshalDeliveryRuleActionImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'Actions' for 'RuleUpdatePropertiesParameters': %+v", i, err) + } + output = append(output, impl) + } + s.Actions = &output + } + + 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([]DeliveryRuleCondition, 0) + for i, val := range listTemp { + impl, err := UnmarshalDeliveryRuleConditionImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'Conditions' for 'RuleUpdatePropertiesParameters': %+v", i, err) + } + output = append(output, impl) + } + s.Conditions = &output + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_serverportmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_serverportmatchconditionparameters.go new file mode 100644 index 000000000000..8f96177dbcb5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_serverportmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = ServerPortMatchConditionParameters{} + +type ServerPortMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator ServerPortOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s ServerPortMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = ServerPortMatchConditionParameters{} + +func (s ServerPortMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper ServerPortMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPortMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPortMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleServerPortConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPortMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_socketaddrmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_socketaddrmatchconditionparameters.go new file mode 100644 index 000000000000..c5056b07bd93 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_socketaddrmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = SocketAddrMatchConditionParameters{} + +type SocketAddrMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator SocketAddrOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s SocketAddrMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = SocketAddrMatchConditionParameters{} + +func (s SocketAddrMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper SocketAddrMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SocketAddrMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SocketAddrMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleSocketAddrConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SocketAddrMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_sslprotocolmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_sslprotocolmatchconditionparameters.go new file mode 100644 index 000000000000..e424bb27aaf5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_sslprotocolmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = SslProtocolMatchConditionParameters{} + +type SslProtocolMatchConditionParameters struct { + MatchValues *[]SslProtocol `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator SslProtocolOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s SslProtocolMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = SslProtocolMatchConditionParameters{} + +func (s SslProtocolMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper SslProtocolMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SslProtocolMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SslProtocolMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleSslProtocolConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SslProtocolMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfileextensionmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfileextensionmatchconditionparameters.go new file mode 100644 index 000000000000..275ca468b7ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfileextensionmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = URLFileExtensionMatchConditionParameters{} + +type URLFileExtensionMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator URLFileExtensionOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s URLFileExtensionMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = URLFileExtensionMatchConditionParameters{} + +func (s URLFileExtensionMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper URLFileExtensionMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling URLFileExtensionMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling URLFileExtensionMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleUrlFileExtensionMatchConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling URLFileExtensionMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfilenamematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfilenamematchconditionparameters.go new file mode 100644 index 000000000000..5d6316c6493f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfilenamematchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = URLFileNameMatchConditionParameters{} + +type URLFileNameMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator URLFileNameOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s URLFileNameMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = URLFileNameMatchConditionParameters{} + +func (s URLFileNameMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper URLFileNameMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling URLFileNameMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling URLFileNameMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleUrlFilenameConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling URLFileNameMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlpathmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlpathmatchconditionparameters.go new file mode 100644 index 000000000000..e62c36d355c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlpathmatchconditionparameters.go @@ -0,0 +1,53 @@ +package rules + +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 _ DeliveryRuleConditionParameters = URLPathMatchConditionParameters{} + +type URLPathMatchConditionParameters struct { + MatchValues *[]string `json:"matchValues,omitempty"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator URLPathOperator `json:"operator"` + Transforms *[]Transform `json:"transforms,omitempty"` + + // Fields inherited from DeliveryRuleConditionParameters + + TypeName DeliveryRuleConditionParametersType `json:"typeName"` +} + +func (s URLPathMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { + return BaseDeliveryRuleConditionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = URLPathMatchConditionParameters{} + +func (s URLPathMatchConditionParameters) MarshalJSON() ([]byte, error) { + type wrapper URLPathMatchConditionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling URLPathMatchConditionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling URLPathMatchConditionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleUrlPathMatchConditionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling URLPathMatchConditionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectaction.go new file mode 100644 index 000000000000..578a809c1593 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectaction.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleAction = URLRedirectAction{} + +type URLRedirectAction struct { + Parameters URLRedirectActionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleAction + + Name DeliveryRuleActionName `json:"name"` +} + +func (s URLRedirectAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return BaseDeliveryRuleActionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = URLRedirectAction{} + +func (s URLRedirectAction) MarshalJSON() ([]byte, error) { + type wrapper URLRedirectAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling URLRedirectAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling URLRedirectAction: %+v", err) + } + + decoded["name"] = "UrlRedirect" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling URLRedirectAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectactionparameters.go new file mode 100644 index 000000000000..e9f8a9a7ada1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectactionparameters.go @@ -0,0 +1,55 @@ +package rules + +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 _ DeliveryRuleActionParameters = URLRedirectActionParameters{} + +type URLRedirectActionParameters struct { + CustomFragment *string `json:"customFragment,omitempty"` + CustomHostname *string `json:"customHostname,omitempty"` + CustomPath *string `json:"customPath,omitempty"` + CustomQueryString *string `json:"customQueryString,omitempty"` + DestinationProtocol *DestinationProtocol `json:"destinationProtocol,omitempty"` + RedirectType RedirectType `json:"redirectType"` + + // Fields inherited from DeliveryRuleActionParameters + + TypeName DeliveryRuleActionParametersType `json:"typeName"` +} + +func (s URLRedirectActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return BaseDeliveryRuleActionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = URLRedirectActionParameters{} + +func (s URLRedirectActionParameters) MarshalJSON() ([]byte, error) { + type wrapper URLRedirectActionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling URLRedirectActionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling URLRedirectActionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleUrlRedirectActionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling URLRedirectActionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteaction.go new file mode 100644 index 000000000000..a8b1e21014c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteaction.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleAction = URLRewriteAction{} + +type URLRewriteAction struct { + Parameters URLRewriteActionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleAction + + Name DeliveryRuleActionName `json:"name"` +} + +func (s URLRewriteAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return BaseDeliveryRuleActionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = URLRewriteAction{} + +func (s URLRewriteAction) MarshalJSON() ([]byte, error) { + type wrapper URLRewriteAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling URLRewriteAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling URLRewriteAction: %+v", err) + } + + decoded["name"] = "UrlRewrite" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling URLRewriteAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteactionparameters.go new file mode 100644 index 000000000000..e142109b4259 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteactionparameters.go @@ -0,0 +1,52 @@ +package rules + +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 _ DeliveryRuleActionParameters = URLRewriteActionParameters{} + +type URLRewriteActionParameters struct { + Destination string `json:"destination"` + PreserveUnmatchedPath *bool `json:"preserveUnmatchedPath,omitempty"` + SourcePattern string `json:"sourcePattern"` + + // Fields inherited from DeliveryRuleActionParameters + + TypeName DeliveryRuleActionParametersType `json:"typeName"` +} + +func (s URLRewriteActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return BaseDeliveryRuleActionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = URLRewriteActionParameters{} + +func (s URLRewriteActionParameters) MarshalJSON() ([]byte, error) { + type wrapper URLRewriteActionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling URLRewriteActionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling URLRewriteActionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleUrlRewriteActionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling URLRewriteActionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningaction.go new file mode 100644 index 000000000000..7d5cb1faa224 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningaction.go @@ -0,0 +1,50 @@ +package rules + +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 _ DeliveryRuleAction = URLSigningAction{} + +type URLSigningAction struct { + Parameters URLSigningActionParameters `json:"parameters"` + + // Fields inherited from DeliveryRuleAction + + Name DeliveryRuleActionName `json:"name"` +} + +func (s URLSigningAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { + return BaseDeliveryRuleActionImpl{ + Name: s.Name, + } +} + +var _ json.Marshaler = URLSigningAction{} + +func (s URLSigningAction) MarshalJSON() ([]byte, error) { + type wrapper URLSigningAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling URLSigningAction: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling URLSigningAction: %+v", err) + } + + decoded["name"] = "UrlSigning" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling URLSigningAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningactionparameters.go new file mode 100644 index 000000000000..787ca3ac7c11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningactionparameters.go @@ -0,0 +1,51 @@ +package rules + +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 _ DeliveryRuleActionParameters = URLSigningActionParameters{} + +type URLSigningActionParameters struct { + Algorithm *Algorithm `json:"algorithm,omitempty"` + ParameterNameOverride *[]URLSigningParamIdentifier `json:"parameterNameOverride,omitempty"` + + // Fields inherited from DeliveryRuleActionParameters + + TypeName DeliveryRuleActionParametersType `json:"typeName"` +} + +func (s URLSigningActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { + return BaseDeliveryRuleActionParametersImpl{ + TypeName: s.TypeName, + } +} + +var _ json.Marshaler = URLSigningActionParameters{} + +func (s URLSigningActionParameters) MarshalJSON() ([]byte, error) { + type wrapper URLSigningActionParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling URLSigningActionParameters: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling URLSigningActionParameters: %+v", err) + } + + decoded["typeName"] = "DeliveryRuleUrlSigningActionParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling URLSigningActionParameters: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningparamidentifier.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningparamidentifier.go new file mode 100644 index 000000000000..6b81c77c9b8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningparamidentifier.go @@ -0,0 +1,9 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type URLSigningParamIdentifier struct { + ParamIndicator ParamIndicator `json:"paramIndicator"` + ParamName string `json:"paramName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/predicates.go new file mode 100644 index 000000000000..0dd99d7ba7d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/predicates.go @@ -0,0 +1,27 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RuleOperationPredicate) Matches(input Rule) bool { + + 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/cdn/2024-09-01/rules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/version.go new file mode 100644 index 000000000000..92f94359d2cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/version.go @@ -0,0 +1,10 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/rules/2024-09-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/README.md new file mode 100644 index 000000000000..92bdbcf5cc18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies` Documentation + +The `webapplicationfirewallpolicies` SDK allows for interaction with Azure Resource Manager `frontdoor` (API Version `2024-02-01`). + +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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" +``` + + +### Client Initialization + +```go +client := webapplicationfirewallpolicies.NewWebApplicationFirewallPoliciesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesCreateOrUpdate` + +```go +ctx := context.TODO() +id := webapplicationfirewallpolicies.NewFrontDoorWebApplicationFirewallPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorWebApplicationFirewallPolicyName") + +payload := webapplicationfirewallpolicies.WebApplicationFirewallPolicy{ + // ... +} + + +if err := client.PoliciesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesDelete` + +```go +ctx := context.TODO() +id := webapplicationfirewallpolicies.NewFrontDoorWebApplicationFirewallPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorWebApplicationFirewallPolicyName") + +if err := client.PoliciesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesGet` + +```go +ctx := context.TODO() +id := webapplicationfirewallpolicies.NewFrontDoorWebApplicationFirewallPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorWebApplicationFirewallPolicyName") + +read, err := client.PoliciesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesList` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.PoliciesList(ctx, id)` can be used to do batched pagination +items, err := client.PoliciesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.PoliciesListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.PoliciesListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesUpdate` + +```go +ctx := context.TODO() +id := webapplicationfirewallpolicies.NewFrontDoorWebApplicationFirewallPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorWebApplicationFirewallPolicyName") + +payload := webapplicationfirewallpolicies.TagsObject{ + // ... +} + + +if err := client.PoliciesUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/client.go new file mode 100644 index 000000000000..490f50430c43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/client.go @@ -0,0 +1,18 @@ +package webapplicationfirewallpolicies + +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 WebApplicationFirewallPoliciesClient struct { + Client autorest.Client + baseUri string +} + +func NewWebApplicationFirewallPoliciesClientWithBaseURI(endpoint string) WebApplicationFirewallPoliciesClient { + return WebApplicationFirewallPoliciesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/constants.go new file mode 100644 index 000000000000..30ee141cf426 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/constants.go @@ -0,0 +1,697 @@ +package webapplicationfirewallpolicies + +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 ( + ActionTypeAllow ActionType = "Allow" + ActionTypeAnomalyScoring ActionType = "AnomalyScoring" + ActionTypeBlock ActionType = "Block" + ActionTypeJSChallenge ActionType = "JSChallenge" + ActionTypeLog ActionType = "Log" + ActionTypeRedirect ActionType = "Redirect" +) + +func PossibleValuesForActionType() []string { + return []string{ + string(ActionTypeAllow), + string(ActionTypeAnomalyScoring), + string(ActionTypeBlock), + string(ActionTypeJSChallenge), + string(ActionTypeLog), + string(ActionTypeRedirect), + } +} + +func parseActionType(input string) (*ActionType, error) { + vals := map[string]ActionType{ + "allow": ActionTypeAllow, + "anomalyscoring": ActionTypeAnomalyScoring, + "block": ActionTypeBlock, + "jschallenge": ActionTypeJSChallenge, + "log": ActionTypeLog, + "redirect": ActionTypeRedirect, + } + 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 CustomRuleEnabledState string + +const ( + CustomRuleEnabledStateDisabled CustomRuleEnabledState = "Disabled" + CustomRuleEnabledStateEnabled CustomRuleEnabledState = "Enabled" +) + +func PossibleValuesForCustomRuleEnabledState() []string { + return []string{ + string(CustomRuleEnabledStateDisabled), + string(CustomRuleEnabledStateEnabled), + } +} + +func parseCustomRuleEnabledState(input string) (*CustomRuleEnabledState, error) { + vals := map[string]CustomRuleEnabledState{ + "disabled": CustomRuleEnabledStateDisabled, + "enabled": CustomRuleEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomRuleEnabledState(input) + return &out, nil +} + +type ManagedRuleEnabledState string + +const ( + ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" + ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" +) + +func PossibleValuesForManagedRuleEnabledState() []string { + return []string{ + string(ManagedRuleEnabledStateDisabled), + string(ManagedRuleEnabledStateEnabled), + } +} + +func parseManagedRuleEnabledState(input string) (*ManagedRuleEnabledState, error) { + vals := map[string]ManagedRuleEnabledState{ + "disabled": ManagedRuleEnabledStateDisabled, + "enabled": ManagedRuleEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedRuleEnabledState(input) + return &out, nil +} + +type ManagedRuleExclusionMatchVariable string + +const ( + ManagedRuleExclusionMatchVariableQueryStringArgNames ManagedRuleExclusionMatchVariable = "QueryStringArgNames" + ManagedRuleExclusionMatchVariableRequestBodyJsonArgNames ManagedRuleExclusionMatchVariable = "RequestBodyJsonArgNames" + ManagedRuleExclusionMatchVariableRequestBodyPostArgNames ManagedRuleExclusionMatchVariable = "RequestBodyPostArgNames" + ManagedRuleExclusionMatchVariableRequestCookieNames ManagedRuleExclusionMatchVariable = "RequestCookieNames" + ManagedRuleExclusionMatchVariableRequestHeaderNames ManagedRuleExclusionMatchVariable = "RequestHeaderNames" +) + +func PossibleValuesForManagedRuleExclusionMatchVariable() []string { + return []string{ + string(ManagedRuleExclusionMatchVariableQueryStringArgNames), + string(ManagedRuleExclusionMatchVariableRequestBodyJsonArgNames), + string(ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), + string(ManagedRuleExclusionMatchVariableRequestCookieNames), + string(ManagedRuleExclusionMatchVariableRequestHeaderNames), + } +} + +func parseManagedRuleExclusionMatchVariable(input string) (*ManagedRuleExclusionMatchVariable, error) { + vals := map[string]ManagedRuleExclusionMatchVariable{ + "querystringargnames": ManagedRuleExclusionMatchVariableQueryStringArgNames, + "requestbodyjsonargnames": ManagedRuleExclusionMatchVariableRequestBodyJsonArgNames, + "requestbodypostargnames": ManagedRuleExclusionMatchVariableRequestBodyPostArgNames, + "requestcookienames": ManagedRuleExclusionMatchVariableRequestCookieNames, + "requestheadernames": ManagedRuleExclusionMatchVariableRequestHeaderNames, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedRuleExclusionMatchVariable(input) + return &out, nil +} + +type ManagedRuleExclusionSelectorMatchOperator string + +const ( + ManagedRuleExclusionSelectorMatchOperatorContains ManagedRuleExclusionSelectorMatchOperator = "Contains" + ManagedRuleExclusionSelectorMatchOperatorEndsWith ManagedRuleExclusionSelectorMatchOperator = "EndsWith" + ManagedRuleExclusionSelectorMatchOperatorEquals ManagedRuleExclusionSelectorMatchOperator = "Equals" + ManagedRuleExclusionSelectorMatchOperatorEqualsAny ManagedRuleExclusionSelectorMatchOperator = "EqualsAny" + ManagedRuleExclusionSelectorMatchOperatorStartsWith ManagedRuleExclusionSelectorMatchOperator = "StartsWith" +) + +func PossibleValuesForManagedRuleExclusionSelectorMatchOperator() []string { + return []string{ + string(ManagedRuleExclusionSelectorMatchOperatorContains), + string(ManagedRuleExclusionSelectorMatchOperatorEndsWith), + string(ManagedRuleExclusionSelectorMatchOperatorEquals), + string(ManagedRuleExclusionSelectorMatchOperatorEqualsAny), + string(ManagedRuleExclusionSelectorMatchOperatorStartsWith), + } +} + +func parseManagedRuleExclusionSelectorMatchOperator(input string) (*ManagedRuleExclusionSelectorMatchOperator, error) { + vals := map[string]ManagedRuleExclusionSelectorMatchOperator{ + "contains": ManagedRuleExclusionSelectorMatchOperatorContains, + "endswith": ManagedRuleExclusionSelectorMatchOperatorEndsWith, + "equals": ManagedRuleExclusionSelectorMatchOperatorEquals, + "equalsany": ManagedRuleExclusionSelectorMatchOperatorEqualsAny, + "startswith": ManagedRuleExclusionSelectorMatchOperatorStartsWith, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedRuleExclusionSelectorMatchOperator(input) + return &out, nil +} + +type ManagedRuleSetActionType string + +const ( + ManagedRuleSetActionTypeBlock ManagedRuleSetActionType = "Block" + ManagedRuleSetActionTypeLog ManagedRuleSetActionType = "Log" + ManagedRuleSetActionTypeRedirect ManagedRuleSetActionType = "Redirect" +) + +func PossibleValuesForManagedRuleSetActionType() []string { + return []string{ + string(ManagedRuleSetActionTypeBlock), + string(ManagedRuleSetActionTypeLog), + string(ManagedRuleSetActionTypeRedirect), + } +} + +func parseManagedRuleSetActionType(input string) (*ManagedRuleSetActionType, error) { + vals := map[string]ManagedRuleSetActionType{ + "block": ManagedRuleSetActionTypeBlock, + "log": ManagedRuleSetActionTypeLog, + "redirect": ManagedRuleSetActionTypeRedirect, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedRuleSetActionType(input) + return &out, nil +} + +type MatchVariable string + +const ( + MatchVariableCookies MatchVariable = "Cookies" + MatchVariablePostArgs MatchVariable = "PostArgs" + MatchVariableQueryString MatchVariable = "QueryString" + MatchVariableRemoteAddr MatchVariable = "RemoteAddr" + MatchVariableRequestBody MatchVariable = "RequestBody" + MatchVariableRequestHeader MatchVariable = "RequestHeader" + MatchVariableRequestMethod MatchVariable = "RequestMethod" + MatchVariableRequestUri MatchVariable = "RequestUri" + MatchVariableSocketAddr MatchVariable = "SocketAddr" +) + +func PossibleValuesForMatchVariable() []string { + return []string{ + string(MatchVariableCookies), + string(MatchVariablePostArgs), + string(MatchVariableQueryString), + string(MatchVariableRemoteAddr), + string(MatchVariableRequestBody), + string(MatchVariableRequestHeader), + string(MatchVariableRequestMethod), + string(MatchVariableRequestUri), + string(MatchVariableSocketAddr), + } +} + +func parseMatchVariable(input string) (*MatchVariable, error) { + vals := map[string]MatchVariable{ + "cookies": MatchVariableCookies, + "postargs": MatchVariablePostArgs, + "querystring": MatchVariableQueryString, + "remoteaddr": MatchVariableRemoteAddr, + "requestbody": MatchVariableRequestBody, + "requestheader": MatchVariableRequestHeader, + "requestmethod": MatchVariableRequestMethod, + "requesturi": MatchVariableRequestUri, + "socketaddr": MatchVariableSocketAddr, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MatchVariable(input) + return &out, nil +} + +type Operator string + +const ( + OperatorAny Operator = "Any" + OperatorBeginsWith Operator = "BeginsWith" + OperatorContains Operator = "Contains" + OperatorEndsWith Operator = "EndsWith" + OperatorEqual Operator = "Equal" + OperatorGeoMatch Operator = "GeoMatch" + OperatorGreaterThan Operator = "GreaterThan" + OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" + OperatorIPMatch Operator = "IPMatch" + OperatorLessThan Operator = "LessThan" + OperatorLessThanOrEqual Operator = "LessThanOrEqual" + OperatorRegEx Operator = "RegEx" +) + +func PossibleValuesForOperator() []string { + return []string{ + string(OperatorAny), + string(OperatorBeginsWith), + string(OperatorContains), + string(OperatorEndsWith), + string(OperatorEqual), + string(OperatorGeoMatch), + string(OperatorGreaterThan), + string(OperatorGreaterThanOrEqual), + string(OperatorIPMatch), + string(OperatorLessThan), + string(OperatorLessThanOrEqual), + string(OperatorRegEx), + } +} + +func parseOperator(input string) (*Operator, error) { + vals := map[string]Operator{ + "any": OperatorAny, + "beginswith": OperatorBeginsWith, + "contains": OperatorContains, + "endswith": OperatorEndsWith, + "equal": OperatorEqual, + "geomatch": OperatorGeoMatch, + "greaterthan": OperatorGreaterThan, + "greaterthanorequal": OperatorGreaterThanOrEqual, + "ipmatch": OperatorIPMatch, + "lessthan": OperatorLessThan, + "lessthanorequal": OperatorLessThanOrEqual, + "regex": OperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Operator(input) + return &out, nil +} + +type PolicyEnabledState string + +const ( + PolicyEnabledStateDisabled PolicyEnabledState = "Disabled" + PolicyEnabledStateEnabled PolicyEnabledState = "Enabled" +) + +func PossibleValuesForPolicyEnabledState() []string { + return []string{ + string(PolicyEnabledStateDisabled), + string(PolicyEnabledStateEnabled), + } +} + +func parsePolicyEnabledState(input string) (*PolicyEnabledState, error) { + vals := map[string]PolicyEnabledState{ + "disabled": PolicyEnabledStateDisabled, + "enabled": PolicyEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyEnabledState(input) + return &out, nil +} + +type PolicyMode string + +const ( + PolicyModeDetection PolicyMode = "Detection" + PolicyModePrevention PolicyMode = "Prevention" +) + +func PossibleValuesForPolicyMode() []string { + return []string{ + string(PolicyModeDetection), + string(PolicyModePrevention), + } +} + +func parsePolicyMode(input string) (*PolicyMode, error) { + vals := map[string]PolicyMode{ + "detection": PolicyModeDetection, + "prevention": PolicyModePrevention, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyMode(input) + return &out, nil +} + +type PolicyRequestBodyCheck string + +const ( + PolicyRequestBodyCheckDisabled PolicyRequestBodyCheck = "Disabled" + PolicyRequestBodyCheckEnabled PolicyRequestBodyCheck = "Enabled" +) + +func PossibleValuesForPolicyRequestBodyCheck() []string { + return []string{ + string(PolicyRequestBodyCheckDisabled), + string(PolicyRequestBodyCheckEnabled), + } +} + +func parsePolicyRequestBodyCheck(input string) (*PolicyRequestBodyCheck, error) { + vals := map[string]PolicyRequestBodyCheck{ + "disabled": PolicyRequestBodyCheckDisabled, + "enabled": PolicyRequestBodyCheckEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyRequestBodyCheck(input) + return &out, nil +} + +type PolicyResourceState string + +const ( + PolicyResourceStateCreating PolicyResourceState = "Creating" + PolicyResourceStateDeleting PolicyResourceState = "Deleting" + PolicyResourceStateDisabled PolicyResourceState = "Disabled" + PolicyResourceStateDisabling PolicyResourceState = "Disabling" + PolicyResourceStateEnabled PolicyResourceState = "Enabled" + PolicyResourceStateEnabling PolicyResourceState = "Enabling" +) + +func PossibleValuesForPolicyResourceState() []string { + return []string{ + string(PolicyResourceStateCreating), + string(PolicyResourceStateDeleting), + string(PolicyResourceStateDisabled), + string(PolicyResourceStateDisabling), + string(PolicyResourceStateEnabled), + string(PolicyResourceStateEnabling), + } +} + +func parsePolicyResourceState(input string) (*PolicyResourceState, error) { + vals := map[string]PolicyResourceState{ + "creating": PolicyResourceStateCreating, + "deleting": PolicyResourceStateDeleting, + "disabled": PolicyResourceStateDisabled, + "disabling": PolicyResourceStateDisabling, + "enabled": PolicyResourceStateEnabled, + "enabling": PolicyResourceStateEnabling, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyResourceState(input) + return &out, nil +} + +type RuleType string + +const ( + RuleTypeMatchRule RuleType = "MatchRule" + RuleTypeRateLimitRule RuleType = "RateLimitRule" +) + +func PossibleValuesForRuleType() []string { + return []string{ + string(RuleTypeMatchRule), + string(RuleTypeRateLimitRule), + } +} + +func parseRuleType(input string) (*RuleType, error) { + vals := map[string]RuleType{ + "matchrule": RuleTypeMatchRule, + "ratelimitrule": RuleTypeRateLimitRule, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RuleType(input) + return &out, nil +} + +type ScrubbingRuleEntryMatchOperator string + +const ( + ScrubbingRuleEntryMatchOperatorEquals ScrubbingRuleEntryMatchOperator = "Equals" + ScrubbingRuleEntryMatchOperatorEqualsAny ScrubbingRuleEntryMatchOperator = "EqualsAny" +) + +func PossibleValuesForScrubbingRuleEntryMatchOperator() []string { + return []string{ + string(ScrubbingRuleEntryMatchOperatorEquals), + string(ScrubbingRuleEntryMatchOperatorEqualsAny), + } +} + +func parseScrubbingRuleEntryMatchOperator(input string) (*ScrubbingRuleEntryMatchOperator, error) { + vals := map[string]ScrubbingRuleEntryMatchOperator{ + "equals": ScrubbingRuleEntryMatchOperatorEquals, + "equalsany": ScrubbingRuleEntryMatchOperatorEqualsAny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScrubbingRuleEntryMatchOperator(input) + return &out, nil +} + +type ScrubbingRuleEntryMatchVariable string + +const ( + ScrubbingRuleEntryMatchVariableQueryStringArgNames ScrubbingRuleEntryMatchVariable = "QueryStringArgNames" + ScrubbingRuleEntryMatchVariableRequestBodyJsonArgNames ScrubbingRuleEntryMatchVariable = "RequestBodyJsonArgNames" + ScrubbingRuleEntryMatchVariableRequestBodyPostArgNames ScrubbingRuleEntryMatchVariable = "RequestBodyPostArgNames" + ScrubbingRuleEntryMatchVariableRequestCookieNames ScrubbingRuleEntryMatchVariable = "RequestCookieNames" + ScrubbingRuleEntryMatchVariableRequestHeaderNames ScrubbingRuleEntryMatchVariable = "RequestHeaderNames" + ScrubbingRuleEntryMatchVariableRequestIPAddress ScrubbingRuleEntryMatchVariable = "RequestIPAddress" + ScrubbingRuleEntryMatchVariableRequestUri ScrubbingRuleEntryMatchVariable = "RequestUri" +) + +func PossibleValuesForScrubbingRuleEntryMatchVariable() []string { + return []string{ + string(ScrubbingRuleEntryMatchVariableQueryStringArgNames), + string(ScrubbingRuleEntryMatchVariableRequestBodyJsonArgNames), + string(ScrubbingRuleEntryMatchVariableRequestBodyPostArgNames), + string(ScrubbingRuleEntryMatchVariableRequestCookieNames), + string(ScrubbingRuleEntryMatchVariableRequestHeaderNames), + string(ScrubbingRuleEntryMatchVariableRequestIPAddress), + string(ScrubbingRuleEntryMatchVariableRequestUri), + } +} + +func parseScrubbingRuleEntryMatchVariable(input string) (*ScrubbingRuleEntryMatchVariable, error) { + vals := map[string]ScrubbingRuleEntryMatchVariable{ + "querystringargnames": ScrubbingRuleEntryMatchVariableQueryStringArgNames, + "requestbodyjsonargnames": ScrubbingRuleEntryMatchVariableRequestBodyJsonArgNames, + "requestbodypostargnames": ScrubbingRuleEntryMatchVariableRequestBodyPostArgNames, + "requestcookienames": ScrubbingRuleEntryMatchVariableRequestCookieNames, + "requestheadernames": ScrubbingRuleEntryMatchVariableRequestHeaderNames, + "requestipaddress": ScrubbingRuleEntryMatchVariableRequestIPAddress, + "requesturi": ScrubbingRuleEntryMatchVariableRequestUri, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScrubbingRuleEntryMatchVariable(input) + return &out, nil +} + +type ScrubbingRuleEntryState string + +const ( + ScrubbingRuleEntryStateDisabled ScrubbingRuleEntryState = "Disabled" + ScrubbingRuleEntryStateEnabled ScrubbingRuleEntryState = "Enabled" +) + +func PossibleValuesForScrubbingRuleEntryState() []string { + return []string{ + string(ScrubbingRuleEntryStateDisabled), + string(ScrubbingRuleEntryStateEnabled), + } +} + +func parseScrubbingRuleEntryState(input string) (*ScrubbingRuleEntryState, error) { + vals := map[string]ScrubbingRuleEntryState{ + "disabled": ScrubbingRuleEntryStateDisabled, + "enabled": ScrubbingRuleEntryStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScrubbingRuleEntryState(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameClassicAzureFrontDoor SkuName = "Classic_AzureFrontDoor" + SkuNamePremiumAzureFrontDoor SkuName = "Premium_AzureFrontDoor" + SkuNameStandardAzureFrontDoor SkuName = "Standard_AzureFrontDoor" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameClassicAzureFrontDoor), + string(SkuNamePremiumAzureFrontDoor), + string(SkuNameStandardAzureFrontDoor), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "classic_azurefrontdoor": SkuNameClassicAzureFrontDoor, + "premium_azurefrontdoor": SkuNamePremiumAzureFrontDoor, + "standard_azurefrontdoor": SkuNameStandardAzureFrontDoor, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type TransformType string + +const ( + TransformTypeLowercase TransformType = "Lowercase" + TransformTypeRemoveNulls TransformType = "RemoveNulls" + TransformTypeTrim TransformType = "Trim" + TransformTypeURLDecode TransformType = "UrlDecode" + TransformTypeURLEncode TransformType = "UrlEncode" + TransformTypeUppercase TransformType = "Uppercase" +) + +func PossibleValuesForTransformType() []string { + return []string{ + string(TransformTypeLowercase), + string(TransformTypeRemoveNulls), + string(TransformTypeTrim), + string(TransformTypeURLDecode), + string(TransformTypeURLEncode), + string(TransformTypeUppercase), + } +} + +func parseTransformType(input string) (*TransformType, error) { + vals := map[string]TransformType{ + "lowercase": TransformTypeLowercase, + "removenulls": TransformTypeRemoveNulls, + "trim": TransformTypeTrim, + "urldecode": TransformTypeURLDecode, + "urlencode": TransformTypeURLEncode, + "uppercase": TransformTypeUppercase, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TransformType(input) + return &out, nil +} + +type VariableName string + +const ( + VariableNameGeoLocation VariableName = "GeoLocation" + VariableNameNone VariableName = "None" + VariableNameSocketAddr VariableName = "SocketAddr" +) + +func PossibleValuesForVariableName() []string { + return []string{ + string(VariableNameGeoLocation), + string(VariableNameNone), + string(VariableNameSocketAddr), + } +} + +func parseVariableName(input string) (*VariableName, error) { + vals := map[string]VariableName{ + "geolocation": VariableNameGeoLocation, + "none": VariableNameNone, + "socketaddr": VariableNameSocketAddr, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VariableName(input) + return &out, nil +} + +type WebApplicationFirewallScrubbingState string + +const ( + WebApplicationFirewallScrubbingStateDisabled WebApplicationFirewallScrubbingState = "Disabled" + WebApplicationFirewallScrubbingStateEnabled WebApplicationFirewallScrubbingState = "Enabled" +) + +func PossibleValuesForWebApplicationFirewallScrubbingState() []string { + return []string{ + string(WebApplicationFirewallScrubbingStateDisabled), + string(WebApplicationFirewallScrubbingStateEnabled), + } +} + +func parseWebApplicationFirewallScrubbingState(input string) (*WebApplicationFirewallScrubbingState, error) { + vals := map[string]WebApplicationFirewallScrubbingState{ + "disabled": WebApplicationFirewallScrubbingStateDisabled, + "enabled": WebApplicationFirewallScrubbingStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WebApplicationFirewallScrubbingState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go new file mode 100644 index 000000000000..ea2136522571 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go @@ -0,0 +1,130 @@ +package webapplicationfirewallpolicies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&FrontDoorWebApplicationFirewallPolicyId{}) +} + +var _ resourceids.ResourceId = &FrontDoorWebApplicationFirewallPolicyId{} + +// FrontDoorWebApplicationFirewallPolicyId is a struct representing the Resource ID for a Front Door Web Application Firewall Policy +type FrontDoorWebApplicationFirewallPolicyId struct { + SubscriptionId string + ResourceGroupName string + FrontDoorWebApplicationFirewallPolicyName string +} + +// NewFrontDoorWebApplicationFirewallPolicyID returns a new FrontDoorWebApplicationFirewallPolicyId struct +func NewFrontDoorWebApplicationFirewallPolicyID(subscriptionId string, resourceGroupName string, frontDoorWebApplicationFirewallPolicyName string) FrontDoorWebApplicationFirewallPolicyId { + return FrontDoorWebApplicationFirewallPolicyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FrontDoorWebApplicationFirewallPolicyName: frontDoorWebApplicationFirewallPolicyName, + } +} + +// ParseFrontDoorWebApplicationFirewallPolicyID parses 'input' into a FrontDoorWebApplicationFirewallPolicyId +func ParseFrontDoorWebApplicationFirewallPolicyID(input string) (*FrontDoorWebApplicationFirewallPolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(&FrontDoorWebApplicationFirewallPolicyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FrontDoorWebApplicationFirewallPolicyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively parses 'input' case-insensitively into a FrontDoorWebApplicationFirewallPolicyId +// note: this method should only be used for API response data and not user input +func ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively(input string) (*FrontDoorWebApplicationFirewallPolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(&FrontDoorWebApplicationFirewallPolicyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FrontDoorWebApplicationFirewallPolicyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FrontDoorWebApplicationFirewallPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.FrontDoorWebApplicationFirewallPolicyName, ok = input.Parsed["frontDoorWebApplicationFirewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontDoorWebApplicationFirewallPolicyName", input) + } + + return nil +} + +// ValidateFrontDoorWebApplicationFirewallPolicyID checks that 'input' can be parsed as a Front Door Web Application Firewall Policy ID +func ValidateFrontDoorWebApplicationFirewallPolicyID(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 := ParseFrontDoorWebApplicationFirewallPolicyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Front Door Web Application Firewall Policy ID +func (id FrontDoorWebApplicationFirewallPolicyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FrontDoorWebApplicationFirewallPolicyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Front Door Web Application Firewall Policy ID +func (id FrontDoorWebApplicationFirewallPolicyId) 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("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("staticFrontDoorWebApplicationFirewallPolicies", "frontDoorWebApplicationFirewallPolicies", "frontDoorWebApplicationFirewallPolicies"), + resourceids.UserSpecifiedSegment("frontDoorWebApplicationFirewallPolicyName", "frontDoorWebApplicationFirewallPolicyName"), + } +} + +// String returns a human-readable description of this Front Door Web Application Firewall Policy ID +func (id FrontDoorWebApplicationFirewallPolicyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Front Door Web Application Firewall Policy Name: %q", id.FrontDoorWebApplicationFirewallPolicyName), + } + return fmt.Sprintf("Front Door Web Application Firewall Policy (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiescreateorupdate_autorest.go new file mode 100644 index 000000000000..e03605ddf6b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiescreateorupdate_autorest.go @@ -0,0 +1,80 @@ +package webapplicationfirewallpolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *WebApplicationFirewallPolicy +} + +// PoliciesCreateOrUpdate ... +func (c WebApplicationFirewallPoliciesClient) PoliciesCreateOrUpdate(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId, input WebApplicationFirewallPolicy) (result PoliciesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForPoliciesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForPoliciesCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PoliciesCreateOrUpdateThenPoll performs PoliciesCreateOrUpdate then polls until it's completed +func (c WebApplicationFirewallPoliciesClient) PoliciesCreateOrUpdateThenPoll(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId, input WebApplicationFirewallPolicy) error { + result, err := c.PoliciesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PoliciesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PoliciesCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForPoliciesCreateOrUpdate prepares the PoliciesCreateOrUpdate request. +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesCreateOrUpdate(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId, input WebApplicationFirewallPolicy) (*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)) +} + +// senderForPoliciesCreateOrUpdate sends the PoliciesCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c WebApplicationFirewallPoliciesClient) senderForPoliciesCreateOrUpdate(ctx context.Context, req *http.Request) (future PoliciesCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiesdelete_autorest.go new file mode 100644 index 000000000000..bc80949a54aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiesdelete_autorest.go @@ -0,0 +1,78 @@ +package webapplicationfirewallpolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// PoliciesDelete ... +func (c WebApplicationFirewallPoliciesClient) PoliciesDelete(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) (result PoliciesDeleteOperationResponse, err error) { + req, err := c.preparerForPoliciesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForPoliciesDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PoliciesDeleteThenPoll performs PoliciesDelete then polls until it's completed +func (c WebApplicationFirewallPoliciesClient) PoliciesDeleteThenPoll(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) error { + result, err := c.PoliciesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing PoliciesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PoliciesDelete: %+v", err) + } + + return nil +} + +// preparerForPoliciesDelete prepares the PoliciesDelete request. +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesDelete(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) (*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)) +} + +// senderForPoliciesDelete sends the PoliciesDelete request. The method will close the +// http.Response Body if it receives an error. +func (c WebApplicationFirewallPoliciesClient) senderForPoliciesDelete(ctx context.Context, req *http.Request) (future PoliciesDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiesget_autorest.go new file mode 100644 index 000000000000..c1fa84824e4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiesget_autorest.go @@ -0,0 +1,68 @@ +package webapplicationfirewallpolicies + +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 PoliciesGetOperationResponse struct { + HttpResponse *http.Response + Model *WebApplicationFirewallPolicy +} + +// PoliciesGet ... +func (c WebApplicationFirewallPoliciesClient) PoliciesGet(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) (result PoliciesGetOperationResponse, err error) { + req, err := c.preparerForPoliciesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPoliciesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPoliciesGet prepares the PoliciesGet request. +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesGet(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) (*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)) +} + +// responderForPoliciesGet handles the response to the PoliciesGet request. The method always +// closes the http.Response Body. +func (c WebApplicationFirewallPoliciesClient) responderForPoliciesGet(resp *http.Response) (result PoliciesGetOperationResponse, 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/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policieslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policieslist_autorest.go new file mode 100644 index 000000000000..45a893e1f6af --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policieslist_autorest.go @@ -0,0 +1,187 @@ +package webapplicationfirewallpolicies + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesListOperationResponse struct { + HttpResponse *http.Response + Model *[]WebApplicationFirewallPolicy + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (PoliciesListOperationResponse, error) +} + +type PoliciesListCompleteResult struct { + Items []WebApplicationFirewallPolicy +} + +func (r PoliciesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r PoliciesListOperationResponse) LoadMore(ctx context.Context) (resp PoliciesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// PoliciesList ... +func (c WebApplicationFirewallPoliciesClient) PoliciesList(ctx context.Context, id commonids.ResourceGroupId) (resp PoliciesListOperationResponse, err error) { + req, err := c.preparerForPoliciesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForPoliciesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForPoliciesList prepares the PoliciesList request. +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesList(ctx context.Context, id commonids.ResourceGroupId) (*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.Network/frontDoorWebApplicationFirewallPolicies", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForPoliciesListWithNextLink prepares the PoliciesList request with the given nextLink token. +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesListWithNextLink(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)) +} + +// responderForPoliciesList handles the response to the PoliciesList request. The method always +// closes the http.Response Body. +func (c WebApplicationFirewallPoliciesClient) responderForPoliciesList(resp *http.Response) (result PoliciesListOperationResponse, err error) { + type page struct { + Values []WebApplicationFirewallPolicy `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 PoliciesListOperationResponse, err error) { + req, err := c.preparerForPoliciesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPoliciesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// PoliciesListComplete retrieves all of the results into a single object +func (c WebApplicationFirewallPoliciesClient) PoliciesListComplete(ctx context.Context, id commonids.ResourceGroupId) (PoliciesListCompleteResult, error) { + return c.PoliciesListCompleteMatchingPredicate(ctx, id, WebApplicationFirewallPolicyOperationPredicate{}) +} + +// PoliciesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WebApplicationFirewallPoliciesClient) PoliciesListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate WebApplicationFirewallPolicyOperationPredicate) (resp PoliciesListCompleteResult, err error) { + items := make([]WebApplicationFirewallPolicy, 0) + + page, err := c.PoliciesList(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 := PoliciesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policieslistbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policieslistbysubscription_autorest.go new file mode 100644 index 000000000000..041f3f7e811a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policieslistbysubscription_autorest.go @@ -0,0 +1,187 @@ +package webapplicationfirewallpolicies + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]WebApplicationFirewallPolicy + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (PoliciesListBySubscriptionOperationResponse, error) +} + +type PoliciesListBySubscriptionCompleteResult struct { + Items []WebApplicationFirewallPolicy +} + +func (r PoliciesListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r PoliciesListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp PoliciesListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// PoliciesListBySubscription ... +func (c WebApplicationFirewallPoliciesClient) PoliciesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp PoliciesListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForPoliciesListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForPoliciesListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForPoliciesListBySubscription prepares the PoliciesListBySubscription request. +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*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.Network/frontDoorWebApplicationFirewallPolicies", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForPoliciesListBySubscriptionWithNextLink prepares the PoliciesListBySubscription request with the given nextLink token. +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesListBySubscriptionWithNextLink(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)) +} + +// responderForPoliciesListBySubscription handles the response to the PoliciesListBySubscription request. The method always +// closes the http.Response Body. +func (c WebApplicationFirewallPoliciesClient) responderForPoliciesListBySubscription(resp *http.Response) (result PoliciesListBySubscriptionOperationResponse, err error) { + type page struct { + Values []WebApplicationFirewallPolicy `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 PoliciesListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForPoliciesListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPoliciesListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// PoliciesListBySubscriptionComplete retrieves all of the results into a single object +func (c WebApplicationFirewallPoliciesClient) PoliciesListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (PoliciesListBySubscriptionCompleteResult, error) { + return c.PoliciesListBySubscriptionCompleteMatchingPredicate(ctx, id, WebApplicationFirewallPolicyOperationPredicate{}) +} + +// PoliciesListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WebApplicationFirewallPoliciesClient) PoliciesListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate WebApplicationFirewallPolicyOperationPredicate) (resp PoliciesListBySubscriptionCompleteResult, err error) { + items := make([]WebApplicationFirewallPolicy, 0) + + page, err := c.PoliciesListBySubscription(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 := PoliciesListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiesupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiesupdate_autorest.go new file mode 100644 index 000000000000..c871f5c4f3d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/method_policiesupdate_autorest.go @@ -0,0 +1,80 @@ +package webapplicationfirewallpolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *WebApplicationFirewallPolicy +} + +// PoliciesUpdate ... +func (c WebApplicationFirewallPoliciesClient) PoliciesUpdate(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId, input TagsObject) (result PoliciesUpdateOperationResponse, err error) { + req, err := c.preparerForPoliciesUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForPoliciesUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PoliciesUpdateThenPoll performs PoliciesUpdate then polls until it's completed +func (c WebApplicationFirewallPoliciesClient) PoliciesUpdateThenPoll(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId, input TagsObject) error { + result, err := c.PoliciesUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PoliciesUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PoliciesUpdate: %+v", err) + } + + return nil +} + +// preparerForPoliciesUpdate prepares the PoliciesUpdate request. +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesUpdate(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId, input TagsObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPoliciesUpdate sends the PoliciesUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c WebApplicationFirewallPoliciesClient) senderForPoliciesUpdate(ctx context.Context, req *http.Request) (future PoliciesUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_customrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_customrule.go new file mode 100644 index 000000000000..48503e8600a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_customrule.go @@ -0,0 +1,16 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomRule struct { + Action ActionType `json:"action"` + EnabledState *CustomRuleEnabledState `json:"enabledState,omitempty"` + GroupBy *[]GroupByVariable `json:"groupBy,omitempty"` + MatchConditions []MatchCondition `json:"matchConditions"` + Name *string `json:"name,omitempty"` + Priority int64 `json:"priority"` + RateLimitDurationInMinutes *int64 `json:"rateLimitDurationInMinutes,omitempty"` + RateLimitThreshold *int64 `json:"rateLimitThreshold,omitempty"` + RuleType RuleType `json:"ruleType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_customrulelist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_customrulelist.go new file mode 100644 index 000000000000..4af1175aedfa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_customrulelist.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomRuleList struct { + Rules *[]CustomRule `json:"rules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_frontendendpointlink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_frontendendpointlink.go new file mode 100644 index 000000000000..4912c45c4479 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_frontendendpointlink.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendEndpointLink struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_groupbyvariable.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_groupbyvariable.go new file mode 100644 index 000000000000..914c2ffb2b6f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_groupbyvariable.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GroupByVariable struct { + VariableName VariableName `json:"variableName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedruleexclusion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedruleexclusion.go new file mode 100644 index 000000000000..61fe93748f11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedruleexclusion.go @@ -0,0 +1,10 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleExclusion struct { + MatchVariable ManagedRuleExclusionMatchVariable `json:"matchVariable"` + Selector string `json:"selector"` + SelectorMatchOperator ManagedRuleExclusionSelectorMatchOperator `json:"selectorMatchOperator"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedrulegroupoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedrulegroupoverride.go new file mode 100644 index 000000000000..b6fb2b34e9e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedrulegroupoverride.go @@ -0,0 +1,10 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleGroupOverride struct { + Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` + RuleGroupName string `json:"ruleGroupName"` + Rules *[]ManagedRuleOverride `json:"rules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedruleoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedruleoverride.go new file mode 100644 index 000000000000..0161ef1d4614 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedruleoverride.go @@ -0,0 +1,11 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleOverride struct { + Action *ActionType `json:"action,omitempty"` + EnabledState *ManagedRuleEnabledState `json:"enabledState,omitempty"` + Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` + RuleId string `json:"ruleId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedruleset.go new file mode 100644 index 000000000000..52b00b82e6a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedruleset.go @@ -0,0 +1,12 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleSet struct { + Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` + RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` + RuleSetAction *ManagedRuleSetActionType `json:"ruleSetAction,omitempty"` + RuleSetType string `json:"ruleSetType"` + RuleSetVersion string `json:"ruleSetVersion"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedrulesetlist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedrulesetlist.go new file mode 100644 index 000000000000..f15de67cc0c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_managedrulesetlist.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleSetList struct { + ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_matchcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_matchcondition.go new file mode 100644 index 000000000000..b39cb7d4f89b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_matchcondition.go @@ -0,0 +1,13 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MatchCondition struct { + MatchValue []string `json:"matchValue"` + MatchVariable MatchVariable `json:"matchVariable"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator Operator `json:"operator"` + Selector *string `json:"selector,omitempty"` + Transforms *[]TransformType `json:"transforms,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_policysettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_policysettings.go new file mode 100644 index 000000000000..ed2343a24c72 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_policysettings.go @@ -0,0 +1,15 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicySettings struct { + CustomBlockResponseBody *string `json:"customBlockResponseBody,omitempty"` + CustomBlockResponseStatusCode *int64 `json:"customBlockResponseStatusCode,omitempty"` + EnabledState *PolicyEnabledState `json:"enabledState,omitempty"` + JavascriptChallengeExpirationInMinutes *int64 `json:"javascriptChallengeExpirationInMinutes,omitempty"` + LogScrubbing *PolicySettingsLogScrubbing `json:"logScrubbing,omitempty"` + Mode *PolicyMode `json:"mode,omitempty"` + RedirectURL *string `json:"redirectUrl,omitempty"` + RequestBodyCheck *PolicyRequestBodyCheck `json:"requestBodyCheck,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_policysettingslogscrubbing.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_policysettingslogscrubbing.go new file mode 100644 index 000000000000..a97418be8671 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_policysettingslogscrubbing.go @@ -0,0 +1,9 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicySettingsLogScrubbing struct { + ScrubbingRules *[]WebApplicationFirewallScrubbingRules `json:"scrubbingRules,omitempty"` + State *WebApplicationFirewallScrubbingState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_routingrulelink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_routingrulelink.go new file mode 100644 index 000000000000..4f63c00b70ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_routingrulelink.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RoutingRuleLink struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_securitypolicylink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_securitypolicylink.go new file mode 100644 index 000000000000..81251da5f8cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_securitypolicylink.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPolicyLink struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_sku.go new file mode 100644 index 000000000000..2a73ceadea6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_sku.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name *SkuName `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_tagsobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_tagsobject.go new file mode 100644 index 000000000000..6ebacbb7cf10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_tagsobject.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsObject struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicy.go new file mode 100644 index 000000000000..bbfecce16c96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicy.go @@ -0,0 +1,15 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WebApplicationFirewallPolicy struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *WebApplicationFirewallPolicyProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicyproperties.go new file mode 100644 index 000000000000..1d45210a4c00 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicyproperties.go @@ -0,0 +1,15 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WebApplicationFirewallPolicyProperties struct { + CustomRules *CustomRuleList `json:"customRules,omitempty"` + FrontendEndpointLinks *[]FrontendEndpointLink `json:"frontendEndpointLinks,omitempty"` + ManagedRules *ManagedRuleSetList `json:"managedRules,omitempty"` + PolicySettings *PolicySettings `json:"policySettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ResourceState *PolicyResourceState `json:"resourceState,omitempty"` + RoutingRuleLinks *[]RoutingRuleLink `json:"routingRuleLinks,omitempty"` + SecurityPolicyLinks *[]SecurityPolicyLink `json:"securityPolicyLinks,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_webapplicationfirewallscrubbingrules.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_webapplicationfirewallscrubbingrules.go new file mode 100644 index 000000000000..b3d3f6dd209d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/model_webapplicationfirewallscrubbingrules.go @@ -0,0 +1,11 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WebApplicationFirewallScrubbingRules struct { + MatchVariable ScrubbingRuleEntryMatchVariable `json:"matchVariable"` + Selector *string `json:"selector,omitempty"` + SelectorMatchOperator ScrubbingRuleEntryMatchOperator `json:"selectorMatchOperator"` + State *ScrubbingRuleEntryState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/predicates.go new file mode 100644 index 000000000000..a7973b0a14fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/predicates.go @@ -0,0 +1,37 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WebApplicationFirewallPolicyOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p WebApplicationFirewallPolicyOperationPredicate) Matches(input WebApplicationFirewallPolicy) 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.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + 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/frontdoor/2024-02-01/webapplicationfirewallpolicies/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/version.go new file mode 100644 index 000000000000..be660aa76002 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies/version.go @@ -0,0 +1,10 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-02-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/webapplicationfirewallpolicies/2024-02-01" +} diff --git a/vendor/modules.txt b/vendor/modules.txt index cabd0d189771..dad5b86434fe 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -309,6 +309,9 @@ github.com/hashicorp/go-azure-sdk/resource-manager/blueprints/2018-11-01-preview github.com/hashicorp/go-azure-sdk/resource-manager/blueprints/2018-11-01-preview/blueprint github.com/hashicorp/go-azure-sdk/resource-manager/blueprints/2018-11-01-preview/publishedblueprint github.com/hashicorp/go-azure-sdk/resource-manager/botservice/2022-09-15/channel +github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles +github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/securitypolicies +github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01 github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes @@ -544,6 +547,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidre github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors +github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies github.com/hashicorp/go-azure-sdk/resource-manager/graphservices/2023-04-13 github.com/hashicorp/go-azure-sdk/resource-manager/graphservices/2023-04-13/graphservicesprods github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments diff --git a/website/docs/r/cdn_frontdoor_custom_domain.html.markdown b/website/docs/r/cdn_frontdoor_custom_domain.html.markdown index c9ab856e0e55..8398c4bf5bda 100644 --- a/website/docs/r/cdn_frontdoor_custom_domain.html.markdown +++ b/website/docs/r/cdn_frontdoor_custom_domain.html.markdown @@ -91,7 +91,7 @@ The following arguments are supported: **NOTE:** Currently `pre_validated_cdn_frontdoor_custom_domain_id` only supports domains validated by Static Web App. --> +->**Note:** Currently `pre_validated_cdn_frontdoor_custom_domain_id` only supports domains validated by Static Web App. --> * `tls` - (Required) A `tls` block as defined below. @@ -101,11 +101,11 @@ A `tls` block supports the following: * `certificate_type` - (Optional) Defines the source of the SSL certificate. Possible values include `CustomerCertificate` and `ManagedCertificate`. Defaults to `ManagedCertificate`. -->**NOTE:** It may take up to 15 minutes for the Front Door Service to validate the state and Domain ownership of the Custom Domain. +->**Note:** It may take up to 15 minutes for the Front Door Service to validate the state and Domain ownership of the Custom Domain. -* `minimum_tls_version` - (Optional) TLS protocol version that will be used for Https. Possible values include `TLS10` and `TLS12`. Defaults to `TLS12`. +* `minimum_tls_version` - (Optional) TLS protocol version that will be used for Https. Possible values are `TLS12`. Defaults to `TLS12`. -~> **Note** Azure Services will require TLS 1.2+ by August 2025, please see this [announcement](https://azure.microsoft.com/en-us/updates/v2/update-retirement-tls1-0-tls1-1-versions-azure-services/) for more details. +~> **Note:** On March 1, 2025, support for Transport Layer Security (TLS) 1.0 and 1.1 will be retired for Azure Front Door, all connections to Azure Front Door must employ `TLS 1.2` or later, please see the product [announcement](https://azure.microsoft.com/en-us/updates/v2/update-retirement-tls1-0-tls1-1-versions-azure-services/) for more details. * `cdn_frontdoor_secret_id` - (Optional) Resource ID of the Front Door Secret.