From c0f135bed16892f4ea2201113fda3cced3b96256 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Tue, 17 Dec 2024 00:43:25 -0700 Subject: [PATCH 1/3] Check-in progress... --- .../cdn/cdn_frontdoor_rule_resource.go | 171 +- .../cdn/cdn_frontdoor_rule_resource_test.go | 9 +- .../cdn/cdn_frontdoor_rule_set_resource.go | 4 +- internal/services/cdn/client/client.go | 24 +- .../cdn/deliveryruleconditions/cookies.go | 53 +- ...le_condition_polymorphism_discriminator.go | 46 + .../delivery_rule_conditions_helper.go | 28 + .../cdn/deliveryruleconditions/device.go | 47 +- .../deliveryruleconditions/http_version.go | 36 +- .../cdn/deliveryruleconditions/post_arg.go | 48 +- .../cdn_frontdoor_rule_actions.go | 254 +- .../cdn/2024-02-01/origins/README.md | 99 + .../cdn/2024-02-01/origins/client.go | 26 + .../cdn/2024-02-01/origins/constants.go | 154 ++ .../cdn/2024-02-01/origins/id_endpoint.go | 139 + .../cdn/2024-02-01/origins/id_origin.go | 148 ++ .../cdn/2024-02-01/origins/method_create.go | 76 + .../cdn/2024-02-01/origins/method_delete.go | 71 + .../cdn/2024-02-01/origins/method_get.go | 53 + .../origins/method_listbyendpoint.go | 105 + .../cdn/2024-02-01/origins/method_update.go | 75 + .../cdn/2024-02-01/origins/model_origin.go | 16 + .../origins/model_originproperties.go | 21 + .../origins/model_originupdateparameters.go | 8 + .../model_originupdatepropertiesparameters.go | 18 + .../cdn/2024-02-01/origins/predicates.go | 27 + .../cdn/2024-02-01/origins/version.go | 10 + .../cdn/2024-02-01/rules/README.md | 99 + .../cdn/2024-02-01/rules/client.go | 26 + .../cdn/2024-02-01/rules/constants.go | 2268 +++++++++++++++++ .../cdn/2024-02-01/rules/id_rule.go | 148 ++ .../cdn/2024-02-01/rules/id_ruleset.go | 139 + .../cdn/2024-02-01/rules/method_create.go | 76 + .../cdn/2024-02-01/rules/method_delete.go | 71 + .../cdn/2024-02-01/rules/method_get.go | 53 + .../2024-02-01/rules/method_listbyruleset.go | 105 + .../cdn/2024-02-01/rules/method_update.go | 75 + .../rules/model_cacheconfiguration.go | 12 + .../model_cacheexpirationactionparameters.go | 52 + ...del_cachekeyquerystringactionparameters.go | 51 + ...odel_clientportmatchconditionparameters.go | 53 + .../model_cookiesmatchconditionparameters.go | 54 + .../rules/model_deliveryruleaction.go | 139 + .../model_deliveryruleactionparameters.go | 131 + ...model_deliveryrulecacheexpirationaction.go | 50 + ...l_deliveryrulecachekeyquerystringaction.go | 50 + .../model_deliveryruleclientportcondition.go | 50 + .../rules/model_deliveryrulecondition.go | 219 ++ .../model_deliveryruleconditionparameters.go | 219 ++ .../model_deliveryrulecookiescondition.go | 50 + .../model_deliveryrulehostnamecondition.go | 50 + .../model_deliveryrulehttpversioncondition.go | 50 + .../model_deliveryruleisdevicecondition.go | 50 + .../model_deliveryrulepostargscondition.go | 50 + .../model_deliveryrulequerystringcondition.go | 50 + ...odel_deliveryruleremoteaddresscondition.go | 50 + .../model_deliveryrulerequestbodycondition.go | 50 + .../model_deliveryrulerequestheaderaction.go | 50 + ...odel_deliveryrulerequestheadercondition.go | 50 + ...odel_deliveryrulerequestmethodcondition.go | 50 + ...odel_deliveryrulerequestschemecondition.go | 50 + .../model_deliveryrulerequesturicondition.go | 50 + .../model_deliveryruleresponseheaderaction.go | 50 + ...eryrulerouteconfigurationoverrideaction.go | 50 + .../model_deliveryruleserverportcondition.go | 50 + .../model_deliveryrulesocketaddrcondition.go | 50 + .../model_deliveryrulesslprotocolcondition.go | 50 + ...l_deliveryruleurlfileextensioncondition.go | 50 + .../model_deliveryruleurlfilenamecondition.go | 50 + .../model_deliveryruleurlpathcondition.go | 50 + .../rules/model_headeractionparameters.go | 52 + .../model_hostnamematchconditionparameters.go | 53 + ...del_httpversionmatchconditionparameters.go | 53 + .../model_isdevicematchconditionparameters.go | 53 + .../rules/model_origingroupoverride.go | 9 + .../rules/model_origingroupoverrideaction.go | 50 + ...del_origingroupoverrideactionparameters.go | 50 + .../model_postargsmatchconditionparameters.go | 54 + ...del_querystringmatchconditionparameters.go | 53 + ...l_remoteaddressmatchconditionparameters.go | 53 + ...del_requestbodymatchconditionparameters.go | 53 + ...l_requestheadermatchconditionparameters.go | 54 + ...l_requestmethodmatchconditionparameters.go | 53 + ...l_requestschemematchconditionparameters.go | 53 + ...odel_requesturimatchconditionparameters.go | 53 + .../rules/model_resourcereference.go | 8 + ...teconfigurationoverrideactionparameters.go | 51 + .../cdn/2024-02-01/rules/model_rule.go | 16 + .../2024-02-01/rules/model_ruleproperties.go | 81 + .../rules/model_ruleupdateparameters.go | 8 + .../model_ruleupdatepropertiesparameters.go | 75 + ...odel_serverportmatchconditionparameters.go | 53 + ...odel_socketaddrmatchconditionparameters.go | 53 + ...del_sslprotocolmatchconditionparameters.go | 53 + ...rlfileextensionmatchconditionparameters.go | 53 + ...del_urlfilenamematchconditionparameters.go | 53 + .../model_urlpathmatchconditionparameters.go | 53 + .../rules/model_urlredirectaction.go | 50 + .../model_urlredirectactionparameters.go | 55 + .../rules/model_urlrewriteaction.go | 50 + .../rules/model_urlrewriteactionparameters.go | 52 + .../rules/model_urlsigningaction.go | 50 + .../rules/model_urlsigningactionparameters.go | 51 + .../rules/model_urlsigningparamidentifier.go | 9 + .../cdn/2024-02-01/rules/predicates.go | 27 + .../cdn/2024-02-01/rules/version.go | 10 + .../cdn/2024-02-01/rulesets/README.md | 98 + .../cdn/2024-02-01/rulesets/client.go | 26 + .../cdn/2024-02-01/rulesets/constants.go | 145 ++ .../cdn/2024-02-01/rulesets/id_profile.go | 130 + .../cdn/2024-02-01/rulesets/id_ruleset.go | 139 + .../cdn/2024-02-01/rulesets/method_create.go | 54 + .../cdn/2024-02-01/rulesets/method_delete.go | 71 + .../cdn/2024-02-01/rulesets/method_get.go | 53 + .../rulesets/method_listbyprofile.go | 105 + .../rulesets/method_listresourceusage.go | 105 + .../cdn/2024-02-01/rulesets/model_ruleset.go | 16 + .../rulesets/model_rulesetproperties.go | 10 + .../cdn/2024-02-01/rulesets/model_usage.go | 12 + .../2024-02-01/rulesets/model_usagename.go | 9 + .../cdn/2024-02-01/rulesets/predicates.go | 50 + .../cdn/2024-02-01/rulesets/version.go | 10 + vendor/modules.txt | 3 + 123 files changed, 9314 insertions(+), 335 deletions(-) create mode 100644 internal/services/cdn/deliveryruleconditions/delivery_rule_condition_polymorphism_discriminator.go create mode 100644 internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_endpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_origin.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_create.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_listbyendpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_origin.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdatepropertiesparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/id_rule.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/id_ruleset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_create.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_listbyruleset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_cacheconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_cacheexpirationactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_cachekeyquerystringactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_clientportmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_cookiesmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulecacheexpirationaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulecachekeyquerystringaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleclientportcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulecookiescondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulehostnamecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulehttpversioncondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleisdevicecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulepostargscondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulequerystringcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleremoteaddresscondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestbodycondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestheaderaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestheadercondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestmethodcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestschemecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequesturicondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleresponseheaderaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleserverportcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulesocketaddrcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulesslprotocolcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleurlfileextensioncondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleurlfilenamecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleurlpathcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_headeractionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_hostnamematchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_httpversionmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_isdevicematchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_origingroupoverride.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_origingroupoverrideaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_origingroupoverrideactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_postargsmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_querystringmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_remoteaddressmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requestbodymatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requestheadermatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requestmethodmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requestschemematchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requesturimatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_resourcereference.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_routeconfigurationoverrideactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_rule.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_ruleproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_ruleupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_ruleupdatepropertiesparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_serverportmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_socketaddrmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_sslprotocolmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlfileextensionmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlfilenamematchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlpathmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlredirectaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlredirectactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlrewriteaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlrewriteactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlsigningaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlsigningactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlsigningparamidentifier.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/id_profile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/id_ruleset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_create.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_listbyprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_listresourceusage.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_ruleset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_rulesetproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_usage.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_usagename.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/version.go diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource.go b/internal/services/cdn/cdn_frontdoor_rule_resource.go index fa7597ec325a..ff865802b86d 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource.go @@ -7,17 +7,19 @@ import ( "fmt" "time" - "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/2020-09-01/cdn" + "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/rules" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets" "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" cdnFrontDoorRuleConditions "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorruleconditions" - "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" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceCdnFrontDoorRule() *pluginsdk.Resource { @@ -35,7 +37,7 @@ func resourceCdnFrontDoorRule() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FrontDoorRuleID(id) + _, err := rules.ParseRuleID(id) return err }), @@ -57,10 +59,10 @@ func resourceCdnFrontDoorRule() *pluginsdk.Resource { "behavior_on_match": { Type: pluginsdk.TypeString, Optional: true, - Default: string(cdn.MatchProcessingBehaviorContinue), + Default: string(rules.MatchProcessingBehaviorContinue), ValidateFunc: validation.StringInSlice([]string{ - string(cdn.MatchProcessingBehaviorContinue), - string(cdn.MatchProcessingBehaviorStop), + string(rules.MatchProcessingBehaviorContinue), + string(rules.MatchProcessingBehaviorStop), }, false), }, @@ -88,21 +90,21 @@ func resourceCdnFrontDoorRule() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.RedirectTypeMoved), - string(cdn.RedirectTypeFound), - string(cdn.RedirectTypeTemporaryRedirect), - string(cdn.RedirectTypePermanentRedirect), + string(rules.RedirectTypeMoved), + string(rules.RedirectTypeFound), + string(rules.RedirectTypeTemporaryRedirect), + string(rules.RedirectTypePermanentRedirect), }, false), }, "redirect_protocol": { Type: pluginsdk.TypeString, Optional: true, - Default: string(cdn.DestinationProtocolMatchRequest), + Default: string(rules.DestinationProtocolMatchRequest), ValidateFunc: validation.StringInSlice([]string{ - string(cdn.DestinationProtocolMatchRequest), - string(cdn.DestinationProtocolHTTP), - string(cdn.DestinationProtocolHTTPS), + string(rules.DestinationProtocolMatchRequest), + string(rules.DestinationProtocolHTTP), + string(rules.DestinationProtocolHTTPS), }, false), }, @@ -183,9 +185,9 @@ func resourceCdnFrontDoorRule() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.HeaderActionAppend), - string(cdn.HeaderActionOverwrite), - string(cdn.HeaderActionDelete), + string(rules.HeaderActionAppend), + string(rules.HeaderActionOverwrite), + string(rules.HeaderActionDelete), }, false), }, @@ -214,9 +216,9 @@ func resourceCdnFrontDoorRule() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.HeaderActionAppend), - string(cdn.HeaderActionOverwrite), - string(cdn.HeaderActionDelete), + string(rules.HeaderActionAppend), + string(rules.HeaderActionOverwrite), + string(rules.HeaderActionDelete), }, false), }, @@ -253,9 +255,9 @@ func resourceCdnFrontDoorRule() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.ForwardingProtocolHTTPOnly), - string(cdn.ForwardingProtocolHTTPSOnly), - string(cdn.ForwardingProtocolMatchRequest), + string(rules.ForwardingProtocolHTTPOnly), + string(rules.ForwardingProtocolHTTPSOnly), + string(rules.ForwardingProtocolMatchRequest), }, false), }, @@ -264,10 +266,10 @@ func resourceCdnFrontDoorRule() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.RuleQueryStringCachingBehaviorIgnoreQueryString), - string(cdn.RuleQueryStringCachingBehaviorUseQueryString), - string(cdn.RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings), - string(cdn.RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings), + string(rules.RuleQueryStringCachingBehaviorIgnoreQueryString), + string(rules.RuleQueryStringCachingBehaviorUseQueryString), + string(rules.RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings), + string(rules.RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings), }, false), }, @@ -293,10 +295,10 @@ func resourceCdnFrontDoorRule() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.RuleCacheBehaviorHonorOrigin), - string(cdn.RuleCacheBehaviorOverrideAlways), - string(cdn.RuleCacheBehaviorOverrideIfOriginMissing), - string(cdn.RuleIsCompressionEnabledDisabled), + string(rules.RuleCacheBehaviorHonorOrigin), + string(rules.RuleCacheBehaviorOverrideAlways), + string(rules.RuleCacheBehaviorOverrideIfOriginMissing), + string(rules.RuleIsCompressionEnabledDisabled), }, false), }, @@ -614,26 +616,26 @@ func resourceCdnFrontDoorRuleCreate(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - ruleSet, err := parse.FrontDoorRuleSetID(d.Get("cdn_frontdoor_rule_set_id").(string)) + ruleSetId, err := rulesets.ParseRuleSetID(d.Get("cdn_frontdoor_rule_set_id").(string)) if err != nil { return err } - id := parse.NewFrontDoorRuleID(ruleSet.SubscriptionId, ruleSet.ResourceGroup, ruleSet.ProfileName, ruleSet.RuleSetName, d.Get("name").(string)) + id := rules.NewRuleID(ruleSetId.SubscriptionId, ruleSetId.ResourceGroupName, ruleSetId.ProfileName, ruleSetId.RuleSetName, d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName, id.RuleName) + result, err := client.Get(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_rule", id.ID()) } - matchProcessingBehaviorValue := cdn.MatchProcessingBehavior(d.Get("behavior_on_match").(string)) - order := d.Get("order").(int) + matchProcessingBehaviorValue := pointer.To(rules.MatchProcessingBehavior(d.Get("behavior_on_match").(string))) + order := pointer.To(int64(d.Get("order").(int))) actions, err := expandFrontdoorDeliveryRuleActions(d.Get("actions").([]interface{})) if err != nil { @@ -645,25 +647,21 @@ func resourceCdnFrontDoorRuleCreate(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("expanding 'conditions': %+v", err) } - props := cdn.Rule{ - RuleProperties: &cdn.RuleProperties{ + props := rules.Rule{ + Properties: &rules.RuleProperties{ Actions: &actions, Conditions: &conditions, MatchProcessingBehavior: matchProcessingBehaviorValue, RuleSetName: &ruleSet.RuleSetName, - Order: utils.Int32(int32(order)), + Order: order, }, } - future, err := client.Create(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName, id.RuleName, 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 resourceCdnFrontDoorRuleRead(d, meta) @@ -674,44 +672,44 @@ func resourceCdnFrontDoorRuleRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorRuleID(d.Id()) + id, err := rules.ParseRuleID(d.Id()) if err != nil { return err } - ruleSet := parse.NewFrontDoorRuleSetID(id.SubscriptionId, id.ResourceGroup, id.ProfileName, id.RuleSetName) + ruleSet := rulesets.NewRuleSetID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName, id.RuleSetName) - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName, id.RuleName) + result, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(result.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.RuleName) - d.Set("cdn_frontdoor_rule_set_id", ruleSet.ID()) + if model := result.Model; model != nil { - if props := resp.RuleProperties; props != nil { - d.Set("behavior_on_match", props.MatchProcessingBehavior) - d.Set("order", props.Order) + if props := model.Properties; props != nil { + d.Set("name", id.RuleName) + d.Set("cdn_frontdoor_rule_set_id", ruleSet.ID()) - // BUG: RuleSetName is not being returned by the API - // Tracking issue opened: https://github.com/Azure/azure-rest-api-specs/issues/20560 - d.Set("cdn_frontdoor_rule_set_name", ruleSet.RuleSetName) + // BUG: RuleSetName is not being returned by the API + // Tracking issue opened: https://github.com/Azure/azure-rest-api-specs/issues/20560 + d.Set("cdn_frontdoor_rule_set_name", ruleSet.RuleSetName) - actions, err := flattenFrontdoorDeliveryRuleActions(props.Actions) - if err != nil { - return fmt.Errorf("setting 'actions': %+v", err) - } - d.Set("actions", actions) + actions, err := flattenFrontdoorDeliveryRuleActions(props.Actions) + if err != nil { + return fmt.Errorf("setting 'actions': %+v", err) + } + d.Set("actions", actions) - conditions, err := flattenFrontdoorDeliveryRuleConditions(props.Conditions) - if err != nil { - return fmt.Errorf("setting 'conditions': %+v", err) + conditions, err := flattenFrontdoorDeliveryRuleConditions(props.Conditions) + if err != nil { + return fmt.Errorf("setting 'conditions': %+v", err) + } + d.Set("conditions", conditions) } - d.Set("conditions", conditions) } return nil @@ -722,23 +720,23 @@ func resourceCdnFrontDoorRuleUpdate(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorRuleID(d.Id()) + id, err := rules.ParseRuleID(d.Id()) if err != nil { return err } - props := cdn.RuleUpdateParameters{ - RuleUpdatePropertiesParameters: &cdn.RuleUpdatePropertiesParameters{}, + params := rules.RuleUpdateParameters{ + Properties: &rules.RuleUpdatePropertiesParameters{}, } if d.HasChange("behavior_on_match") { - matchProcessingBehaviorValue := cdn.MatchProcessingBehavior(d.Get("behavior_on_match").(string)) - props.RuleUpdatePropertiesParameters.MatchProcessingBehavior = matchProcessingBehaviorValue + matchProcessingBehaviorValue := rules.MatchProcessingBehavior(d.Get("behavior_on_match").(string)) + params.Properties.MatchProcessingBehavior = pointer.To(matchProcessingBehaviorValue) } if d.HasChange("order") { - order := d.Get("order").(int) - props.RuleUpdatePropertiesParameters.Order = utils.Int32(int32(order)) + order := int64(d.Get("order").(int)) + params.Properties.Order = pointer.To(order) } if d.HasChange("actions") { @@ -747,7 +745,7 @@ func resourceCdnFrontDoorRuleUpdate(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("expanding 'actions': %+v", err) } - props.RuleUpdatePropertiesParameters.Actions = &actions + params.Properties.Actions = &actions } if d.HasChange("conditions") { @@ -760,16 +758,13 @@ func resourceCdnFrontDoorRuleUpdate(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("expanding 'conditions': configuration file exceeds the maximum of 10 match conditions, got %d", len(conditions)) } - props.RuleUpdatePropertiesParameters.Conditions = &conditions + params.Properties.Conditions = &conditions } - future, err := client.Update(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName, id.RuleName, props) + err = client.UpdateThenPoll(ctx, id, params) 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 resourceCdnFrontDoorRuleRead(d, meta) } @@ -779,24 +774,20 @@ func resourceCdnFrontDoorRuleDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorRuleID(d.Id()) + id, err := rules.ParseRuleID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName, id.RuleName) + err = client.DeleteThenPoll(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 expandFrontdoorDeliveryRuleActions(input []interface{}) ([]cdn.BasicDeliveryRuleAction, error) { +func expandFrontdoorDeliveryRuleActions(input []interface{}) ([]rules.DeliveryRuleAction, error) { results := make([]cdn.BasicDeliveryRuleAction, 0) if len(input) == 0 { return results, nil @@ -905,7 +896,7 @@ func expandFrontdoorDeliveryRuleConditions(input []interface{}) ([]cdn.BasicDeli return results, nil } -func flattenFrontdoorDeliveryRuleConditions(input *[]cdn.BasicDeliveryRuleCondition) ([]interface{}, error) { +func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition) ([]interface{}, error) { results := make([]interface{}, 0) if input == nil { return results, nil @@ -1160,7 +1151,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]cdn.BasicDeliveryRuleCondit return output, nil } -func flattenFrontdoorDeliveryRuleActions(input *[]cdn.BasicDeliveryRuleAction) ([]interface{}, error) { +func flattenFrontdoorDeliveryRuleActions(input *[]rules.DeliveryRuleAction) ([]interface{}, error) { results := make([]interface{}, 0) if input == nil { return results, nil diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource_test.go b/internal/services/cdn/cdn_frontdoor_rule_resource_test.go index 2690c51a6e92..2298a2eb32d6 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource_test.go @@ -9,10 +9,11 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "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" ) @@ -436,15 +437,15 @@ func TestAccCdnFrontDoorRule_urlFilenameConditionOperatorError(t *testing.T) { } func (r CdnFrontDoorRuleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.FrontDoorRuleID(state.ID) + id, err := rules.ParseRuleID(state.ID) if err != nil { return nil, err } client := clients.Cdn.FrontDoorRulesClient - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName, id.RuleName) + result, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(result.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %s: %+v", id, err) diff --git a/internal/services/cdn/cdn_frontdoor_rule_set_resource.go b/internal/services/cdn/cdn_frontdoor_rule_set_resource.go index eb51c5cad14b..5831f902ff4e 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_set_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_set_resource.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets" "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" @@ -61,7 +62,8 @@ func resourceCdnFrontDoorRuleSetCreate(d *pluginsdk.ResourceData, meta interface return err } - id := parse.NewFrontDoorRuleSetID(profile.SubscriptionId, profile.ResourceGroup, profile.ProfileName, d.Get("name").(string)) + // func NewRuleSetID(subscriptionId string, resourceGroupName string, profileName string, ruleSetName string) + id := rulesets.NewRuleSetID(profile.SubscriptionId, profile.ResourceGroup, profile.ProfileName, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName) if err != nil { diff --git a/internal/services/cdn/client/client.go b/internal/services/cdn/client/client.go index a1238124d40a..37a21d8afd61 100644 --- a/internal/services/cdn/client/client.go +++ b/internal/services/cdn/client/client.go @@ -10,6 +10,8 @@ import ( 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/rules" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets" "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" @@ -22,10 +24,10 @@ type Client struct { FrontDoorCustomDomainsClient *cdnFrontDoorSdk.AFDCustomDomainsClient FrontDoorSecurityPoliciesClient *securitypolicies.SecurityPoliciesClient FrontDoorRoutesClient *cdnFrontDoorSdk.RoutesClient - FrontDoorRulesClient *cdnFrontDoorSdk.RulesClient + FrontDoorRulesClient *rules.RulesClient FrontDoorProfilesClient *profiles.ProfilesClient FrontDoorSecretsClient *cdnFrontDoorSdk.SecretsClient - FrontDoorRuleSetsClient *cdnFrontDoorSdk.RuleSetsClient + FrontDoorRuleSetsClient *rulesets.RuleSetsClient FrontDoorLegacyFirewallPoliciesClient *frontdoor.PoliciesClient FrontDoorFirewallPoliciesClient *waf.WebApplicationFirewallPoliciesClient CustomDomainsClient *cdnSdk.CustomDomainsClient @@ -61,8 +63,11 @@ func NewClient(o *common.ClientOptions) (*Client, error) { 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) + frontDoorRulesClient, err := rules.NewRulesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building RulesClient: %+v", err) + } + o.Configure(frontDoorRulesClient.Client, o.Authorizers.ResourceManager) frontDoorProfilesClient, err := profiles.NewProfilesClientWithBaseURI(o.Environment.ResourceManager) if err != nil { @@ -73,8 +78,11 @@ func NewClient(o *common.ClientOptions) (*Client, error) { frontDoorPolicySecretsClient := cdnFrontDoorSdk.NewSecretsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&frontDoorPolicySecretsClient.Client, o.ResourceManagerAuthorizer) - frontDoorRuleSetsClient := cdnFrontDoorSdk.NewRuleSetsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&frontDoorRuleSetsClient.Client, o.ResourceManagerAuthorizer) + frontDoorRuleSetsClient, err := rulesets.NewRuleSetsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building RuleSet: %+v", err) + } + o.Configure(frontDoorRulesClient.Client, o.Authorizers.ResourceManager) customDomainsClient := cdnSdk.NewCustomDomainsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&customDomainsClient.Client, o.ResourceManagerAuthorizer) @@ -92,10 +100,10 @@ func NewClient(o *common.ClientOptions) (*Client, error) { FrontDoorCustomDomainsClient: &frontDoorCustomDomainsClient, FrontDoorSecurityPoliciesClient: frontDoorSecurityPoliciesClient, FrontDoorRoutesClient: &frontDoorRoutesClient, - FrontDoorRulesClient: &frontDoorRulesClient, + FrontDoorRulesClient: frontDoorRulesClient, FrontDoorProfilesClient: frontDoorProfilesClient, FrontDoorSecretsClient: &frontDoorPolicySecretsClient, - FrontDoorRuleSetsClient: &frontDoorRuleSetsClient, + FrontDoorRuleSetsClient: frontDoorRuleSetsClient, FrontDoorLegacyFirewallPoliciesClient: &frontDoorLegacyFirewallPoliciesClient, FrontDoorFirewallPoliciesClient: &frontDoorFirewallPoliciesClient, CustomDomainsClient: &customDomainsClient, diff --git a/internal/services/cdn/deliveryruleconditions/cookies.go b/internal/services/cdn/deliveryruleconditions/cookies.go index 508fda3b3c3b..90a36c49c6e2 100644 --- a/internal/services/cdn/deliveryruleconditions/cookies.go +++ b/internal/services/cdn/deliveryruleconditions/cookies.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -24,17 +25,9 @@ func Cookies() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.OperatorAny), - string(cdn.OperatorBeginsWith), - string(cdn.OperatorContains), - string(cdn.OperatorEndsWith), - string(cdn.OperatorEqual), - string(cdn.OperatorGreaterThan), - string(cdn.OperatorGreaterThanOrEqual), - string(cdn.OperatorLessThan), - string(cdn.OperatorLessThanOrEqual), - }, false), + + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForCookiesOperator(), + false), }, "negate_condition": { @@ -59,8 +52,8 @@ func Cookies() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformUppercase), + string(rules.TransformLowercase), + string(rules.TransformUppercase), }, false), }, }, @@ -68,25 +61,25 @@ func Cookies() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionCookies(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionCookies(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - cookiesCondition := cdn.DeliveryRuleCookiesCondition{ - Name: cdn.NameCookies, - Parameters: &cdn.CookiesMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleCookiesConditionParameters"), - Selector: utils.String(item["selector"].(string)), - Operator: cdn.CookiesOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + cookiesCondition := rules.DeliveryRuleCookiesCondition{ + Name: rules.MatchVariableCookies, + Parameters: rules.CookiesMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleCookiesConditionParameters, + Selector: pointer.To(item["selector"].(string)), + Operator: rules.CookiesOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, } if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]cdn.Transform, 0) + transforms := make([]rules.Transform, 0) for _, t := range rawTransforms { - transforms = append(transforms, cdn.Transform(t.(string))) + transforms = append(transforms, rules.Transform(t.(string))) } cookiesCondition.Parameters.Transforms = &transforms } @@ -97,8 +90,8 @@ func ExpandArmCdnEndpointConditionCookies(input []interface{}) []cdn.BasicDelive return output } -func FlattenArmCdnEndpointConditionCookies(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleCookiesCondition() +func FlattenArmCdnEndpointConditionCookies(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleCookiesCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule cookie condition") } @@ -109,13 +102,13 @@ func FlattenArmCdnEndpointConditionCookies(input cdn.BasicDeliveryRuleCondition) matchValues := make([]interface{}, 0) transforms := make([]string, 0) - if params := condition.Parameters; params != nil { + if params := condition; params != nil { + operator = string(params.Operator) + if params.Selector != nil { selector = *params.Selector } - operator = string(params.Operator) - if params.NegateCondition != nil { negateCondition = *params.NegateCondition } diff --git a/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_polymorphism_discriminator.go b/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_polymorphism_discriminator.go new file mode 100644 index 000000000000..8c9583929f8f --- /dev/null +++ b/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_polymorphism_discriminator.go @@ -0,0 +1,46 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package deliveryruleconditions + +import ( + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" +) + +func AsDeliveryRuleCookiesCondition(input rules.DeliveryRuleCondition) (*rules.CookiesMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableCookies { + return nil, false + } + + cookieParameter := rules.CookiesMatchConditionParameters{} + return pointer.To(cookieParameter), true +} + +func AsDeliveryRuleIsDeviceCondition(input rules.DeliveryRuleCondition) (*rules.IsDeviceMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableIsDevice { + return nil, false + } + + deviceParameter := rules.IsDeviceMatchConditionParameters{} + return pointer.To(deviceParameter), true +} + +func AsDeliveryRuleHTTPVersionCondition(input rules.DeliveryRuleCondition) (*rules.HTTPVersionMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableHTTPVersion { + return nil, false + } + + deviceParameter := rules.HTTPVersionMatchConditionParameters{} + return pointer.To(deviceParameter), true +} + +// AsDeliveryRulePostArgsCondition +func AsDeliveryRulePostArgsCondition(input rules.DeliveryRuleCondition) (*rules.PostArgsMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableHTTPVersion { + return nil, false + } + + postArgParameter := rules.PostArgsMatchConditionParameters{} + return pointer.To(postArgParameter), true +} diff --git a/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go b/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go new file mode 100644 index 000000000000..a2c6af729e5e --- /dev/null +++ b/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go @@ -0,0 +1,28 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package deliveryruleconditions + +import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" +) + +func ExpandIsDeviceMatchValue(input []interface{}) *[]rules.IsDeviceMatchValue { + result := make([]rules.IsDeviceMatchValue, 0) + for _, item := range input { + if item != nil { + result = append(result, rules.IsDeviceMatchValue(item.(string))) + } + } + return &result +} + +func FlattenIsDeviceMatchValue(input *[]rules.IsDeviceMatchValue) []interface{} { + result := make([]interface{}, 0) + if input != nil { + for _, item := range *input { + result = append(result, string(item)) + } + } + return result +} diff --git a/internal/services/cdn/deliveryruleconditions/device.go b/internal/services/cdn/deliveryruleconditions/device.go index aa4ad409f5eb..cb5a33e0ff86 100644 --- a/internal/services/cdn/deliveryruleconditions/device.go +++ b/internal/services/cdn/deliveryruleconditions/device.go @@ -6,10 +6,10 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func Device() *pluginsdk.Resource { @@ -18,10 +18,9 @@ func Device() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Optional: true, - Default: "Equal", - ValidateFunc: validation.StringInSlice([]string{ - "Equal", - }, false), + Default: string(rules.IsDeviceOperatorEqual), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForIsDeviceOperator(), + false), }, "negate_condition": { @@ -36,28 +35,26 @@ func Device() *pluginsdk.Resource { MinItems: 1, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice([]string{ - "Desktop", - "Mobile", - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForIsDeviceMatchValue(), + false), }, }, }, } } -func ExpandArmCdnEndpointConditionDevice(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionDevice(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - output = append(output, cdn.DeliveryRuleIsDeviceCondition{ - Name: cdn.NameHTTPVersion, - Parameters: &cdn.IsDeviceMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleIsDeviceConditionParameters"), - Operator: utils.String(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), - MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + output = append(output, rules.DeliveryRuleIsDeviceCondition{ + Name: rules.MatchVariableIsDevice, + Parameters: rules.IsDeviceMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters, + Operator: rules.IsDeviceOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), + MatchValues: ExpandIsDeviceMatchValue(item["match_values"].(*pluginsdk.Set).List()), }, }) } @@ -65,8 +62,8 @@ func ExpandArmCdnEndpointConditionDevice(input []interface{}) []cdn.BasicDeliver return output } -func FlattenArmCdnEndpointConditionDevice(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleIsDeviceCondition() +func FlattenArmCdnEndpointConditionDevice(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleIsDeviceCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule device condition") } @@ -74,17 +71,15 @@ func FlattenArmCdnEndpointConditionDevice(input cdn.BasicDeliveryRuleCondition) operator := "" matchValues := make([]interface{}, 0) negateCondition := false - if params := condition.Parameters; params != nil { - if params.Operator != nil { - operator = *params.Operator - } + if params := condition; params != nil { + operator = string(params.Operator) if params.NegateCondition != nil { negateCondition = *params.NegateCondition } if params.MatchValues != nil { - matchValues = utils.FlattenStringSlice(params.MatchValues) + matchValues = FlattenIsDeviceMatchValue(params.MatchValues) } } diff --git a/internal/services/cdn/deliveryruleconditions/http_version.go b/internal/services/cdn/deliveryruleconditions/http_version.go index a776ec413361..790bd2c3a99c 100644 --- a/internal/services/cdn/deliveryruleconditions/http_version.go +++ b/internal/services/cdn/deliveryruleconditions/http_version.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -18,10 +19,9 @@ func HTTPVersion() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Optional: true, - Default: "Equal", - ValidateFunc: validation.StringInSlice([]string{ - "Equal", - }, false), + Default: string(rules.HTTPVersionOperatorEqual), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForHTTPVersionOperator(), + false), }, "negate_condition": { @@ -48,17 +48,17 @@ func HTTPVersion() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionHTTPVersion(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionHTTPVersion(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - output = append(output, cdn.DeliveryRuleHTTPVersionCondition{ - Name: cdn.NameHTTPVersion, - Parameters: &cdn.HTTPVersionMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleHttpVersionConditionParameters"), - Operator: utils.String(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + output = append(output, rules.DeliveryRuleHTTPVersionCondition{ + Name: rules.MatchVariableHTTPVersion, + Parameters: rules.HTTPVersionMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleHTTPVersionConditionParameters, + Operator: rules.HTTPVersionOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, }) @@ -67,8 +67,8 @@ func ExpandArmCdnEndpointConditionHTTPVersion(input []interface{}) []cdn.BasicDe return output } -func FlattenArmCdnEndpointConditionHTTPVersion(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleHTTPVersionCondition() +func FlattenArmCdnEndpointConditionHTTPVersion(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleHTTPVersionCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule http version condition") } @@ -76,10 +76,8 @@ func FlattenArmCdnEndpointConditionHTTPVersion(input cdn.BasicDeliveryRuleCondit operator := "" matchValues := make([]interface{}, 0) negateCondition := false - if params := condition.Parameters; params != nil { - if params.Operator != nil { - operator = *params.Operator - } + if params := condition; params != nil { + operator = string(params.Operator) if params.NegateCondition != nil { negateCondition = *params.NegateCondition diff --git a/internal/services/cdn/deliveryruleconditions/post_arg.go b/internal/services/cdn/deliveryruleconditions/post_arg.go index a5754bb1fb24..7f7875e28e0f 100644 --- a/internal/services/cdn/deliveryruleconditions/post_arg.go +++ b/internal/services/cdn/deliveryruleconditions/post_arg.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -24,17 +25,8 @@ func PostArg() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.PostArgsOperatorAny), - string(cdn.PostArgsOperatorBeginsWith), - string(cdn.PostArgsOperatorContains), - string(cdn.PostArgsOperatorEndsWith), - string(cdn.PostArgsOperatorEqual), - string(cdn.PostArgsOperatorGreaterThan), - string(cdn.PostArgsOperatorGreaterThanOrEqual), - string(cdn.PostArgsOperatorLessThan), - string(cdn.PostArgsOperatorLessThanOrEqual), - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForPostArgsOperator(), + false), }, "negate_condition": { @@ -59,8 +51,8 @@ func PostArg() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformUppercase), + string(rules.TransformLowercase), + string(rules.TransformUppercase), }, false), }, }, @@ -68,27 +60,27 @@ func PostArg() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionPostArg(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionPostArg(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRulePostArgsCondition{ - Name: cdn.NameCookies, - Parameters: &cdn.PostArgsMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRulePostArgsConditionParameters"), - Selector: utils.String(item["selector"].(string)), - Operator: cdn.PostArgsOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + condition := rules.DeliveryRulePostArgsCondition{ + Name: rules.MatchVariablePostArgs, + Parameters: rules.PostArgsMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRulePostArgsConditionParameters, + Selector: pointer.To(item["selector"].(string)), + Operator: rules.PostArgsOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, } if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]cdn.Transform, 0) + transforms := make([]rules.Transform, 0) for _, t := range rawTransforms { - transforms = append(transforms, cdn.Transform(t.(string))) + transforms = append(transforms, rules.Transform(t.(string))) } condition.Parameters.Transforms = &transforms } @@ -99,8 +91,8 @@ func ExpandArmCdnEndpointConditionPostArg(input []interface{}) []cdn.BasicDelive return output } -func FlattenArmCdnEndpointConditionPostArg(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRulePostArgsCondition() +func FlattenArmCdnEndpointConditionPostArg(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRulePostArgsCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule post args condition") } @@ -111,7 +103,7 @@ func FlattenArmCdnEndpointConditionPostArg(input cdn.BasicDeliveryRuleCondition) selector := "" transforms := make([]string, 0) - if params := condition.Parameters; params != nil { + if params := condition; params != nil { if params.Selector != nil { selector = *params.Selector } diff --git a/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go b/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go index 77d289b62cc4..0d8a7c779a84 100644 --- a/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go +++ b/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go @@ -1,20 +1,20 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package CdnFrontDoorruleactions +package frontdooractions import ( "fmt" "strings" - "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/terraform-provider-azurerm/internal/services/cdn/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/utils" ) type CdnFrontDoorActionParameters struct { - Name cdn.NameBasicDeliveryRuleAction + Name rules.DeliveryRuleActionName TypeName string ConfigName string } @@ -31,32 +31,32 @@ func InitializeCdnFrontDoorActionMappings() *CdnFrontDoorActionMappings { m := CdnFrontDoorActionMappings{} m.RouteConfigurationOverride = CdnFrontDoorActionParameters{ - Name: cdn.NameBasicDeliveryRuleActionNameRouteConfigurationOverride, - TypeName: "DeliveryRuleRouteConfigurationOverrideActionParameters", + Name: rules.DeliveryRuleActionNameRouteConfigurationOverride, + TypeName: string(rules.DeliveryRuleActionParametersTypeDeliveryRuleRouteConfigurationOverrideActionParameters), ConfigName: "route_configuration_override_action", } m.RequestHeader = CdnFrontDoorActionParameters{ - Name: cdn.NameBasicDeliveryRuleActionNameModifyRequestHeader, - TypeName: "DeliveryRuleHeaderActionParameters", + Name: rules.DeliveryRuleActionNameModifyRequestHeader, + TypeName: string(rules.DeliveryRuleActionParametersTypeDeliveryRuleHeaderActionParameters), ConfigName: "request_header_action", } m.ResponseHeader = CdnFrontDoorActionParameters{ - Name: cdn.NameBasicDeliveryRuleActionNameModifyResponseHeader, - TypeName: "DeliveryRuleHeaderActionParameters", + Name: rules.DeliveryRuleActionNameModifyResponseHeader, + TypeName: string(rules.DeliveryRuleActionParametersTypeDeliveryRuleHeaderActionParameters), ConfigName: "response_header_action", } m.URLRedirect = CdnFrontDoorActionParameters{ - Name: cdn.NameBasicDeliveryRuleActionNameURLRedirect, - TypeName: "DeliveryRuleUrlRedirectActionParameters", + Name: rules.DeliveryRuleActionNameURLRedirect, + TypeName: string(rules.DeliveryRuleActionParametersTypeDeliveryRuleURLRedirectActionParameters), ConfigName: "url_redirect_action", } m.URLRewrite = CdnFrontDoorActionParameters{ - Name: cdn.NameBasicDeliveryRuleActionNameURLRedirect, - TypeName: "DeliveryRuleUrlRewriteActionParameters", + Name: rules.DeliveryRuleActionNameURLRewrite, + TypeName: string(rules.DeliveryRuleActionParametersTypeDeliveryRuleURLRewriteActionParameters), ConfigName: "url_rewrite_action", } @@ -89,8 +89,8 @@ func flattenCsvToStringSlice(input *string) []interface{} { return results } -func ExpandCdnFrontDoorRequestHeaderAction(input []interface{}) (*[]cdn.BasicDeliveryRuleAction, error) { - output := make([]cdn.BasicDeliveryRuleAction, 0) +func ExpandCdnFrontDoorRequestHeaderAction(input []interface{}) (*[]rules.DeliveryRuleAction, error) { + output := make([]rules.DeliveryRuleAction, 0) m := InitializeCdnFrontDoorActionMappings() @@ -99,22 +99,22 @@ func ExpandCdnFrontDoorRequestHeaderAction(input []interface{}) (*[]cdn.BasicDel value := item["value"].(string) - requestHeaderAction := cdn.DeliveryRuleRequestHeaderAction{ + requestHeaderAction := rules.DeliveryRuleRequestHeaderAction{ Name: m.RequestHeader.Name, - Parameters: &cdn.HeaderActionParameters{ - TypeName: &m.RequestHeader.TypeName, - HeaderAction: cdn.HeaderAction(item["header_action"].(string)), - HeaderName: utils.String(item["header_name"].(string)), - Value: utils.String(value), + Parameters: rules.HeaderActionParameters{ + TypeName: rules.DeliveryRuleActionParametersType(m.RequestHeader.TypeName), + HeaderAction: rules.HeaderAction(item["header_action"].(string)), + HeaderName: item["header_name"].(string), + Value: pointer.To(value), }, } if value == "" { - if requestHeaderAction.Parameters.HeaderAction == cdn.HeaderActionOverwrite || requestHeaderAction.Parameters.HeaderAction == cdn.HeaderActionAppend { + if requestHeaderAction.Parameters.HeaderAction == rules.HeaderActionOverwrite || requestHeaderAction.Parameters.HeaderAction == rules.HeaderActionAppend { return nil, fmt.Errorf("the 'request_header_action' block is not valid, 'value' cannot be empty if the 'header_action' is set to 'Append' or 'Overwrite'") } } else { - if requestHeaderAction.Parameters.HeaderAction == cdn.HeaderActionDelete { + if requestHeaderAction.Parameters.HeaderAction == rules.HeaderActionDelete { return nil, fmt.Errorf("the 'request_header_action' block is not valid, 'value' must be empty if the 'header_action' is set to 'Delete'") } } @@ -125,30 +125,30 @@ func ExpandCdnFrontDoorRequestHeaderAction(input []interface{}) (*[]cdn.BasicDel return &output, nil } -func ExpandCdnFrontDoorResponseHeaderAction(input []interface{}) (*[]cdn.BasicDeliveryRuleAction, error) { - output := make([]cdn.BasicDeliveryRuleAction, 0) +func ExpandCdnFrontDoorResponseHeaderAction(input []interface{}) (*[]rules.DeliveryRuleAction, error) { + output := make([]rules.DeliveryRuleAction, 0) m := InitializeCdnFrontDoorActionMappings() for _, v := range input { item := v.(map[string]interface{}) - responseHeaderAction := cdn.DeliveryRuleResponseHeaderAction{ + responseHeaderAction := rules.DeliveryRuleResponseHeaderAction{ Name: m.ResponseHeader.Name, - Parameters: &cdn.HeaderActionParameters{ - TypeName: utils.String(m.ResponseHeader.TypeName), - HeaderAction: cdn.HeaderAction(item["header_action"].(string)), - HeaderName: utils.String(item["header_name"].(string)), - Value: utils.String(item["value"].(string)), + Parameters: rules.HeaderActionParameters{ + TypeName: rules.DeliveryRuleActionParametersType(m.ResponseHeader.TypeName), + HeaderAction: rules.HeaderAction(item["header_action"].(string)), + HeaderName: item["header_name"].(string), + Value: pointer.To(item["value"].(string)), }, } if headerValue := *responseHeaderAction.Parameters.Value; headerValue == "" { - if responseHeaderAction.Parameters.HeaderAction == cdn.HeaderActionOverwrite || responseHeaderAction.Parameters.HeaderAction == cdn.HeaderActionAppend { + if responseHeaderAction.Parameters.HeaderAction == rules.HeaderActionOverwrite || responseHeaderAction.Parameters.HeaderAction == rules.HeaderActionAppend { return nil, fmt.Errorf("the 'response_header_action' block is not valid, 'value' cannot be empty if the 'header_action' is set to 'Append' or 'Overwrite'") } } else { - if responseHeaderAction.Parameters.HeaderAction == cdn.HeaderActionDelete { + if responseHeaderAction.Parameters.HeaderAction == rules.HeaderActionDelete { return nil, fmt.Errorf("the 'response_header_action' block is not valid, 'value' must be empty if the 'header_action' is set to 'Delete'") } } @@ -159,24 +159,24 @@ func ExpandCdnFrontDoorResponseHeaderAction(input []interface{}) (*[]cdn.BasicDe return &output, nil } -func ExpandCdnFrontDoorUrlRedirectAction(input []interface{}) (*[]cdn.BasicDeliveryRuleAction, error) { - output := make([]cdn.BasicDeliveryRuleAction, 0) +func ExpandCdnFrontDoorUrlRedirectAction(input []interface{}) (*[]rules.DeliveryRuleAction, error) { + output := make([]rules.DeliveryRuleAction, 0) m := InitializeCdnFrontDoorActionMappings() for _, v := range input { item := v.(map[string]interface{}) - urlRedirectAction := cdn.URLRedirectAction{ + urlRedirectAction := rules.URLRedirectAction{ Name: m.URLRedirect.Name, - Parameters: &cdn.URLRedirectActionParameters{ - TypeName: utils.String(m.URLRedirect.TypeName), - RedirectType: cdn.RedirectType(item["redirect_type"].(string)), - DestinationProtocol: cdn.DestinationProtocol(item["redirect_protocol"].(string)), - CustomPath: utils.String(item["destination_path"].(string)), - CustomHostname: utils.String(item["destination_hostname"].(string)), - CustomQueryString: utils.String(item["query_string"].(string)), - CustomFragment: utils.String(item["destination_fragment"].(string)), + Parameters: rules.URLRedirectActionParameters{ + TypeName: rules.DeliveryRuleActionParametersType(m.URLRedirect.TypeName), + RedirectType: rules.RedirectType(item["redirect_type"].(string)), + DestinationProtocol: pointer.To(rules.DestinationProtocol(item["redirect_protocol"].(string))), + CustomPath: pointer.To(item["destination_path"].(string)), + CustomHostname: pointer.To(item["destination_hostname"].(string)), + CustomQueryString: pointer.To(item["query_string"].(string)), + CustomFragment: pointer.To(item["destination_fragment"].(string)), }, } @@ -186,21 +186,21 @@ func ExpandCdnFrontDoorUrlRedirectAction(input []interface{}) (*[]cdn.BasicDeliv return &output, nil } -func ExpandCdnFrontDoorUrlRewriteAction(input []interface{}) (*[]cdn.BasicDeliveryRuleAction, error) { - output := make([]cdn.BasicDeliveryRuleAction, 0) +func ExpandCdnFrontDoorUrlRewriteAction(input []interface{}) (*[]rules.DeliveryRuleAction, error) { + output := make([]rules.DeliveryRuleAction, 0) m := InitializeCdnFrontDoorActionMappings() for _, v := range input { item := v.(map[string]interface{}) - urlRedirectAction := cdn.URLRewriteAction{ + urlRedirectAction := rules.URLRewriteAction{ Name: m.URLRewrite.Name, - Parameters: &cdn.URLRewriteActionParameters{ - TypeName: utils.String(m.URLRewrite.TypeName), - Destination: utils.String(item["destination"].(string)), - PreserveUnmatchedPath: utils.Bool(item["preserve_unmatched_path"].(bool)), - SourcePattern: utils.String(item["source_pattern"].(string)), + Parameters: rules.URLRewriteActionParameters{ + TypeName: rules.DeliveryRuleActionParametersType(m.URLRewrite.TypeName), + Destination: item["destination"].(string), + PreserveUnmatchedPath: pointer.To(item["preserve_unmatched_path"].(bool)), + SourcePattern: item["source_pattern"].(string), }, } @@ -210,25 +210,25 @@ func ExpandCdnFrontDoorUrlRewriteAction(input []interface{}) (*[]cdn.BasicDelive return &output, nil } -func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[]cdn.BasicDeliveryRuleAction, error) { - output := make([]cdn.BasicDeliveryRuleAction, 0) +func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[]rules.DeliveryRuleAction, error) { + output := make([]rules.DeliveryRuleAction, 0) m := InitializeCdnFrontDoorActionMappings() for _, v := range input { item := v.(map[string]interface{}) - var originGroupOverride cdn.OriginGroupOverride - var cacheConfiguration cdn.CacheConfiguration + var originGroupOverride rules.OriginGroupOverride + var cacheConfiguration rules.CacheConfiguration originGroupIdRaw := item["cdn_frontdoor_origin_group_id"].(string) protocol := item["forwarding_protocol"].(string) cacheBehavior := item["cache_behavior"].(string) - compressionEnabled := cdn.RuleIsCompressionEnabledEnabled + compressionEnabled := rules.RuleIsCompressionEnabledEnabled queryStringCachingBehavior := item["query_string_caching_behavior"].(string) cacheDuration := item["cache_duration"].(string) if !item["compression_enabled"].(bool) { - compressionEnabled = cdn.RuleIsCompressionEnabledDisabled + compressionEnabled = rules.RuleIsCompressionEnabledDisabled } // NOTE: It is valid to not define the originGroupOverride in the Route Configuration Override Action @@ -238,17 +238,17 @@ func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[ return nil, fmt.Errorf("the 'route_configuration_override_action' block is not valid, the 'forwarding_protocol' field must be set") } - originGroupOverride = cdn.OriginGroupOverride{ - OriginGroup: &cdn.ResourceReference{ - ID: pointer.To(originGroupIdRaw), + originGroupOverride = rules.OriginGroupOverride{ + OriginGroup: &rules.ResourceReference{ + Id: pointer.To(originGroupIdRaw), }, - ForwardingProtocol: cdn.ForwardingProtocol(protocol), + ForwardingProtocol: pointer.To(rules.ForwardingProtocol(protocol)), } } else if originGroupIdRaw == "" && item["forwarding_protocol"].(string) != "" { return nil, fmt.Errorf("the 'route_configuration_override_action' block is not valid, if the 'cdn_frontdoor_origin_group_id' is not set you cannot define the 'forwarding_protocol', got %q", protocol) } - if cacheBehavior == string(cdn.RuleIsCompressionEnabledDisabled) { + if cacheBehavior == string(rules.RuleIsCompressionEnabledDisabled) { if queryStringCachingBehavior != "" { return nil, fmt.Errorf("the 'route_configuration_override_action' block is not valid, if the 'cache_behavior' is set to 'Disabled' you cannot define the 'query_string_caching_behavior', got %q", queryStringCachingBehavior) } @@ -270,7 +270,7 @@ func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[ } // NOTE: if the cacheBehavior is 'HonorOrigin' cacheDuration must be null, issue #19311 - if cacheBehavior != string(cdn.RuleCacheBehaviorHonorOrigin) { + if cacheBehavior != string(rules.RuleCacheBehaviorHonorOrigin) { if cacheDuration == "" { return nil, fmt.Errorf("the 'route_configuration_override_action' block is not valid, the 'cache_duration' field must be set") } @@ -278,11 +278,11 @@ func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[ return nil, fmt.Errorf("the 'route_configuration_override_action' block is not valid, the 'cache_duration' field must not be set if the 'cache_behavior' is 'HonorOrigin'") } - cacheConfiguration = cdn.CacheConfiguration{ - QueryStringCachingBehavior: cdn.RuleQueryStringCachingBehavior(queryStringCachingBehavior), + cacheConfiguration = rules.CacheConfiguration{ + QueryStringCachingBehavior: pointer.To(rules.RuleQueryStringCachingBehavior(queryStringCachingBehavior)), QueryParameters: expandStringSliceToCsvFormat(item["query_string_parameters"].([]interface{})), - IsCompressionEnabled: compressionEnabled, - CacheBehavior: cdn.RuleCacheBehavior(cacheBehavior), + IsCompressionEnabled: pointer.To(compressionEnabled), + CacheBehavior: pointer.To(rules.RuleCacheBehavior(cacheBehavior)), } if cacheDuration != "" { @@ -290,19 +290,19 @@ func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[ } if queryParameters := cacheConfiguration.QueryParameters; queryParameters == nil { - if cacheConfiguration.QueryStringCachingBehavior == cdn.RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings || cacheConfiguration.QueryStringCachingBehavior == cdn.RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings { + if pointer.From(cacheConfiguration.QueryStringCachingBehavior) == rules.RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings || pointer.From(cacheConfiguration.QueryStringCachingBehavior) == rules.RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings { return nil, fmt.Errorf("the 'route_configuration_override_action' block is not valid, 'query_string_parameters' cannot be empty if the 'query_string_caching_behavior' is set to 'IncludeSpecifiedQueryStrings' or 'IgnoreSpecifiedQueryStrings'") } } else { - if cacheConfiguration.QueryStringCachingBehavior == cdn.RuleQueryStringCachingBehaviorUseQueryString || cacheConfiguration.QueryStringCachingBehavior == cdn.RuleQueryStringCachingBehaviorIgnoreQueryString { + if pointer.From(cacheConfiguration.QueryStringCachingBehavior) == rules.RuleQueryStringCachingBehaviorUseQueryString || pointer.From(cacheConfiguration.QueryStringCachingBehavior) == rules.RuleQueryStringCachingBehaviorIgnoreQueryString { return nil, fmt.Errorf("the 'route_configuration_override_action' block is not valid, 'query_string_parameters' must not be set if the'query_string_caching_behavior' is set to 'UseQueryStrings' or 'IgnoreQueryStrings'") } } } - routeConfigurationOverrideAction := cdn.DeliveryRuleRouteConfigurationOverrideAction{ - Parameters: &cdn.RouteConfigurationOverrideActionParameters{ - TypeName: utils.String(m.RouteConfigurationOverride.TypeName), + routeConfigurationOverrideAction := rules.DeliveryRuleRouteConfigurationOverrideAction{ + Parameters: rules.RouteConfigurationOverrideActionParameters{ + TypeName: rules.DeliveryRuleActionParametersType(m.RouteConfigurationOverride.TypeName), }, } @@ -310,7 +310,7 @@ func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[ routeConfigurationOverrideAction.Parameters.OriginGroupOverride = &originGroupOverride } - if cacheConfiguration.CacheDuration != nil || cacheConfiguration.CacheBehavior == cdn.RuleCacheBehaviorHonorOrigin { + if cacheConfiguration.CacheDuration != nil || pointer.From(cacheConfiguration.CacheBehavior) == rules.RuleCacheBehaviorHonorOrigin { routeConfigurationOverrideAction.Parameters.CacheConfiguration = &cacheConfiguration } @@ -320,16 +320,15 @@ func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[ return &output, nil } -func FlattenHeaderActionParameters(input *cdn.HeaderActionParameters) map[string]interface{} { +func FlattenHeaderActionParameters(input *rules.HeaderActionParameters) map[string]interface{} { action := "" name := "" value := "" if params := input; params != nil { action = string(params.HeaderAction) - if params.HeaderName != nil { - name = *params.HeaderName - } + name = params.HeaderName + if params.Value != nil { value = *params.Value } @@ -342,7 +341,7 @@ func FlattenHeaderActionParameters(input *cdn.HeaderActionParameters) map[string } } -func FlattenCdnFrontDoorUrlRedirectAction(input cdn.URLRedirectAction) map[string]interface{} { +func FlattenCdnFrontDoorUrlRedirectAction(input rules.URLRedirectAction) map[string]interface{} { destinationHost := "" destinationPath := "" queryString := "" @@ -350,21 +349,23 @@ func FlattenCdnFrontDoorUrlRedirectAction(input cdn.URLRedirectAction) map[strin redirectType := "" fragment := "" - if params := input.Parameters; params != nil { - if params.CustomHostname != nil { - destinationHost = *params.CustomHostname - } - if params.CustomPath != nil { - destinationPath = *params.CustomPath - } - if params.CustomQueryString != nil { - queryString = *params.CustomQueryString - } - destinationProtocol = string(params.DestinationProtocol) - redirectType = string(params.RedirectType) - if params.CustomFragment != nil { - fragment = *params.CustomFragment - } + params := input.Parameters + + if params.CustomHostname != nil { + destinationHost = *params.CustomHostname + } + if params.CustomPath != nil { + destinationPath = *params.CustomPath + } + if params.CustomQueryString != nil { + queryString = *params.CustomQueryString + } + + destinationProtocol = string(pointer.From(params.DestinationProtocol)) + redirectType = string(params.RedirectType) + + if params.CustomFragment != nil { + fragment = *params.CustomFragment } return map[string]interface{}{ @@ -377,21 +378,16 @@ func FlattenCdnFrontDoorUrlRedirectAction(input cdn.URLRedirectAction) map[strin } } -func FlattenCdnFrontDoorUrlRewriteAction(input cdn.URLRewriteAction) map[string]interface{} { +func FlattenCdnFrontDoorUrlRewriteAction(input rules.URLRewriteAction) map[string]interface{} { destination := "" preservePath := false sourcePattern := "" - if params := input.Parameters; params != nil { - if params.Destination != nil { - destination = *params.Destination - } - if params.PreserveUnmatchedPath != nil { - preservePath = *params.PreserveUnmatchedPath - } - if params.SourcePattern != nil { - sourcePattern = *params.SourcePattern - } - } + + params := input.Parameters + + destination = params.Destination + preservePath = *params.PreserveUnmatchedPath + sourcePattern = params.SourcePattern return map[string]interface{}{ "destination": destination, @@ -400,7 +396,7 @@ func FlattenCdnFrontDoorUrlRewriteAction(input cdn.URLRewriteAction) map[string] } } -func FlattenCdnFrontDoorRouteConfigurationOverrideAction(input cdn.DeliveryRuleRouteConfigurationOverrideAction) (map[string]interface{}, error) { +func FlattenCdnFrontDoorRouteConfigurationOverrideAction(input rules.DeliveryRuleRouteConfigurationOverrideAction) (map[string]interface{}, error) { queryStringCachingBehavior := "" cacheBehavior := "" compressionEnabled := false @@ -409,32 +405,32 @@ func FlattenCdnFrontDoorRouteConfigurationOverrideAction(input cdn.DeliveryRuleR forwardingProtocol := "" originGroupId := "" - if params := input.Parameters; params != nil { - if config := params.CacheConfiguration; config != nil { - queryStringCachingBehavior = string(config.QueryStringCachingBehavior) - cacheBehavior = string(config.CacheBehavior) - compressionEnabled = config.IsCompressionEnabled == cdn.RuleIsCompressionEnabledEnabled - queryParameters = flattenCsvToStringSlice(config.QueryParameters) + params := input.Parameters - if config.CacheDuration != nil { - cacheDuration = *config.CacheDuration - } - } else { - cacheBehavior = string(cdn.RuleIsCompressionEnabledDisabled) - } + if config := params.CacheConfiguration; config != nil { + queryStringCachingBehavior = string(pointer.From(config.QueryStringCachingBehavior)) + cacheBehavior = string(pointer.From(config.CacheBehavior)) + compressionEnabled = pointer.From(config.IsCompressionEnabled) == rules.RuleIsCompressionEnabledEnabled + queryParameters = flattenCsvToStringSlice(config.QueryParameters) - if override := params.OriginGroupOverride; override != nil { - forwardingProtocol = string(override.ForwardingProtocol) + if config.CacheDuration != nil { + cacheDuration = *config.CacheDuration + } + } else { + cacheBehavior = string(rules.RuleIsCompressionEnabledDisabled) + } - // NOTE: Need to normalize this ID here because if you modified this in portal the resourceGroup comes back as resourcegroup. - // ignore the error here since it was set on the resource in Azure and we know it is valid. - originGroup, err := parse.FrontDoorOriginGroupIDInsensitively(*override.OriginGroup.ID) - if err != nil { - return nil, err - } + if override := params.OriginGroupOverride; override != nil { + forwardingProtocol = string(pointer.From(override.ForwardingProtocol)) - originGroupId = originGroup.ID() + // NOTE: Need to normalize this ID here because if you modified this in portal the resourceGroup comes back as resourcegroup. + // ignore the error here since it was set on the resource in Azure and we know it is valid. + originGroup, err := origins.ParseOriginIDInsensitively(*override.OriginGroup.Id) + if err != nil { + return nil, err } + + originGroupId = originGroup.ID() } return map[string]interface{}{ diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/README.md new file mode 100644 index 000000000000..7457f0c448a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins` Documentation + +The `origins` 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/origins" +``` + + +### Client Initialization + +```go +client := origins.NewOriginsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `OriginsClient.Create` + +```go +ctx := context.TODO() +id := origins.NewOriginID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName", "originName") + +payload := origins.Origin{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `OriginsClient.Delete` + +```go +ctx := context.TODO() +id := origins.NewOriginID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName", "originName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `OriginsClient.Get` + +```go +ctx := context.TODO() +id := origins.NewOriginID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName", "originName") + +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: `OriginsClient.ListByEndpoint` + +```go +ctx := context.TODO() +id := origins.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +// alternatively `client.ListByEndpoint(ctx, id)` can be used to do batched pagination +items, err := client.ListByEndpointComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `OriginsClient.Update` + +```go +ctx := context.TODO() +id := origins.NewOriginID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName", "originName") + +payload := origins.OriginUpdateParameters{ + // ... +} + + +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/origins/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/client.go new file mode 100644 index 000000000000..ce3ee970663d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/client.go @@ -0,0 +1,26 @@ +package origins + +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 OriginsClient struct { + Client *resourcemanager.Client +} + +func NewOriginsClientWithBaseURI(sdkApi sdkEnv.Api) (*OriginsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "origins", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OriginsClient: %+v", err) + } + + return &OriginsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/constants.go new file mode 100644 index 000000000000..a04f9ed83bfb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/constants.go @@ -0,0 +1,154 @@ +package origins + +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 OriginProvisioningState string + +const ( + OriginProvisioningStateCreating OriginProvisioningState = "Creating" + OriginProvisioningStateDeleting OriginProvisioningState = "Deleting" + OriginProvisioningStateFailed OriginProvisioningState = "Failed" + OriginProvisioningStateSucceeded OriginProvisioningState = "Succeeded" + OriginProvisioningStateUpdating OriginProvisioningState = "Updating" +) + +func PossibleValuesForOriginProvisioningState() []string { + return []string{ + string(OriginProvisioningStateCreating), + string(OriginProvisioningStateDeleting), + string(OriginProvisioningStateFailed), + string(OriginProvisioningStateSucceeded), + string(OriginProvisioningStateUpdating), + } +} + +func (s *OriginProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOriginProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOriginProvisioningState(input string) (*OriginProvisioningState, error) { + vals := map[string]OriginProvisioningState{ + "creating": OriginProvisioningStateCreating, + "deleting": OriginProvisioningStateDeleting, + "failed": OriginProvisioningStateFailed, + "succeeded": OriginProvisioningStateSucceeded, + "updating": OriginProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OriginProvisioningState(input) + return &out, nil +} + +type OriginResourceState string + +const ( + OriginResourceStateActive OriginResourceState = "Active" + OriginResourceStateCreating OriginResourceState = "Creating" + OriginResourceStateDeleting OriginResourceState = "Deleting" +) + +func PossibleValuesForOriginResourceState() []string { + return []string{ + string(OriginResourceStateActive), + string(OriginResourceStateCreating), + string(OriginResourceStateDeleting), + } +} + +func (s *OriginResourceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOriginResourceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOriginResourceState(input string) (*OriginResourceState, error) { + vals := map[string]OriginResourceState{ + "active": OriginResourceStateActive, + "creating": OriginResourceStateCreating, + "deleting": OriginResourceStateDeleting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OriginResourceState(input) + return &out, nil +} + +type PrivateEndpointStatus string + +const ( + PrivateEndpointStatusApproved PrivateEndpointStatus = "Approved" + PrivateEndpointStatusDisconnected PrivateEndpointStatus = "Disconnected" + PrivateEndpointStatusPending PrivateEndpointStatus = "Pending" + PrivateEndpointStatusRejected PrivateEndpointStatus = "Rejected" + PrivateEndpointStatusTimeout PrivateEndpointStatus = "Timeout" +) + +func PossibleValuesForPrivateEndpointStatus() []string { + return []string{ + string(PrivateEndpointStatusApproved), + string(PrivateEndpointStatusDisconnected), + string(PrivateEndpointStatusPending), + string(PrivateEndpointStatusRejected), + string(PrivateEndpointStatusTimeout), + } +} + +func (s *PrivateEndpointStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointStatus(input string) (*PrivateEndpointStatus, error) { + vals := map[string]PrivateEndpointStatus{ + "approved": PrivateEndpointStatusApproved, + "disconnected": PrivateEndpointStatusDisconnected, + "pending": PrivateEndpointStatusPending, + "rejected": PrivateEndpointStatusRejected, + "timeout": PrivateEndpointStatusTimeout, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_endpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_endpoint.go new file mode 100644 index 000000000000..1949f9dde152 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_endpoint.go @@ -0,0 +1,139 @@ +package origins + +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(&EndpointId{}) +} + +var _ resourceids.ResourceId = &EndpointId{} + +// EndpointId is a struct representing the Resource ID for a Endpoint +type EndpointId struct { + SubscriptionId string + ResourceGroupName string + ProfileName string + EndpointName string +} + +// NewEndpointID returns a new EndpointId struct +func NewEndpointID(subscriptionId string, resourceGroupName string, profileName string, endpointName string) EndpointId { + return EndpointId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProfileName: profileName, + EndpointName: endpointName, + } +} + +// ParseEndpointID parses 'input' into a EndpointId +func ParseEndpointID(input string) (*EndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(&EndpointId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EndpointId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseEndpointIDInsensitively parses 'input' case-insensitively into a EndpointId +// note: this method should only be used for API response data and not user input +func ParseEndpointIDInsensitively(input string) (*EndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(&EndpointId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EndpointId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EndpointId) 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.EndpointName, ok = input.Parsed["endpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointName", input) + } + + return nil +} + +// ValidateEndpointID checks that 'input' can be parsed as a Endpoint ID +func ValidateEndpointID(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 := ParseEndpointID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Endpoint ID +func (id EndpointId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/endpoints/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName, id.EndpointName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Endpoint ID +func (id EndpointId) 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("staticEndpoints", "endpoints", "endpoints"), + resourceids.UserSpecifiedSegment("endpointName", "endpointName"), + } +} + +// String returns a human-readable description of this Endpoint ID +func (id EndpointId) 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("Endpoint Name: %q", id.EndpointName), + } + return fmt.Sprintf("Endpoint (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_origin.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_origin.go new file mode 100644 index 000000000000..fcdddcb853d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_origin.go @@ -0,0 +1,148 @@ +package origins + +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(&OriginId{}) +} + +var _ resourceids.ResourceId = &OriginId{} + +// OriginId is a struct representing the Resource ID for a Origin +type OriginId struct { + SubscriptionId string + ResourceGroupName string + ProfileName string + EndpointName string + OriginName string +} + +// NewOriginID returns a new OriginId struct +func NewOriginID(subscriptionId string, resourceGroupName string, profileName string, endpointName string, originName string) OriginId { + return OriginId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProfileName: profileName, + EndpointName: endpointName, + OriginName: originName, + } +} + +// ParseOriginID parses 'input' into a OriginId +func ParseOriginID(input string) (*OriginId, error) { + parser := resourceids.NewParserFromResourceIdType(&OriginId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OriginId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseOriginIDInsensitively parses 'input' case-insensitively into a OriginId +// note: this method should only be used for API response data and not user input +func ParseOriginIDInsensitively(input string) (*OriginId, error) { + parser := resourceids.NewParserFromResourceIdType(&OriginId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OriginId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OriginId) 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.EndpointName, ok = input.Parsed["endpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointName", input) + } + + if id.OriginName, ok = input.Parsed["originName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "originName", input) + } + + return nil +} + +// ValidateOriginID checks that 'input' can be parsed as a Origin ID +func ValidateOriginID(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 := ParseOriginID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Origin ID +func (id OriginId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/endpoints/%s/origins/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName, id.EndpointName, id.OriginName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Origin ID +func (id OriginId) 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("staticEndpoints", "endpoints", "endpoints"), + resourceids.UserSpecifiedSegment("endpointName", "endpointName"), + resourceids.StaticSegment("staticOrigins", "origins", "origins"), + resourceids.UserSpecifiedSegment("originName", "originName"), + } +} + +// String returns a human-readable description of this Origin ID +func (id OriginId) 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("Endpoint Name: %q", id.EndpointName), + fmt.Sprintf("Origin Name: %q", id.OriginName), + } + return fmt.Sprintf("Origin (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_create.go new file mode 100644 index 000000000000..e6005a205a42 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_create.go @@ -0,0 +1,76 @@ +package origins + +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 *Origin +} + +// Create ... +func (c OriginsClient) Create(ctx context.Context, id OriginId, input Origin) (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 OriginsClient) CreateThenPoll(ctx context.Context, id OriginId, input Origin) 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/origins/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_delete.go new file mode 100644 index 000000000000..47d36e6e87f5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_delete.go @@ -0,0 +1,71 @@ +package origins + +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 OriginsClient) Delete(ctx context.Context, id OriginId) (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 OriginsClient) DeleteThenPoll(ctx context.Context, id OriginId) 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/origins/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_get.go new file mode 100644 index 000000000000..a7594c26290f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_get.go @@ -0,0 +1,53 @@ +package origins + +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 *Origin +} + +// Get ... +func (c OriginsClient) Get(ctx context.Context, id OriginId) (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 Origin + 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/origins/method_listbyendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_listbyendpoint.go new file mode 100644 index 000000000000..476f311d7bbe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_listbyendpoint.go @@ -0,0 +1,105 @@ +package origins + +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 ListByEndpointOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Origin +} + +type ListByEndpointCompleteResult struct { + LatestHttpResponse *http.Response + Items []Origin +} + +type ListByEndpointCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByEndpointCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByEndpoint ... +func (c OriginsClient) ListByEndpoint(ctx context.Context, id EndpointId) (result ListByEndpointOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByEndpointCustomPager{}, + Path: fmt.Sprintf("%s/origins", 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 *[]Origin `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByEndpointComplete retrieves all the results into a single object +func (c OriginsClient) ListByEndpointComplete(ctx context.Context, id EndpointId) (ListByEndpointCompleteResult, error) { + return c.ListByEndpointCompleteMatchingPredicate(ctx, id, OriginOperationPredicate{}) +} + +// ListByEndpointCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c OriginsClient) ListByEndpointCompleteMatchingPredicate(ctx context.Context, id EndpointId, predicate OriginOperationPredicate) (result ListByEndpointCompleteResult, err error) { + items := make([]Origin, 0) + + resp, err := c.ListByEndpoint(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 = ListByEndpointCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_update.go new file mode 100644 index 000000000000..830da0e27ffe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_update.go @@ -0,0 +1,75 @@ +package origins + +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 *Origin +} + +// Update ... +func (c OriginsClient) Update(ctx context.Context, id OriginId, input OriginUpdateParameters) (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 OriginsClient) UpdateThenPoll(ctx context.Context, id OriginId, input OriginUpdateParameters) 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/origins/model_origin.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_origin.go new file mode 100644 index 000000000000..38f21bdbd290 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_origin.go @@ -0,0 +1,16 @@ +package origins + +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 Origin struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *OriginProperties `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/origins/model_originproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originproperties.go new file mode 100644 index 000000000000..1c6a60f33a7b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originproperties.go @@ -0,0 +1,21 @@ +package origins + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OriginProperties struct { + Enabled *bool `json:"enabled,omitempty"` + HTTPPort *int64 `json:"httpPort,omitempty"` + HTTPSPort *int64 `json:"httpsPort,omitempty"` + HostName *string `json:"hostName,omitempty"` + OriginHostHeader *string `json:"originHostHeader,omitempty"` + Priority *int64 `json:"priority,omitempty"` + PrivateEndpointStatus *PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + PrivateLinkResourceId *string `json:"privateLinkResourceId,omitempty"` + ProvisioningState *OriginProvisioningState `json:"provisioningState,omitempty"` + ResourceState *OriginResourceState `json:"resourceState,omitempty"` + Weight *int64 `json:"weight,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdateparameters.go new file mode 100644 index 000000000000..7277698e9d5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdateparameters.go @@ -0,0 +1,8 @@ +package origins + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OriginUpdateParameters struct { + Properties *OriginUpdatePropertiesParameters `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdatepropertiesparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdatepropertiesparameters.go new file mode 100644 index 000000000000..c442bb8d4d93 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdatepropertiesparameters.go @@ -0,0 +1,18 @@ +package origins + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OriginUpdatePropertiesParameters struct { + Enabled *bool `json:"enabled,omitempty"` + HTTPPort *int64 `json:"httpPort,omitempty"` + HTTPSPort *int64 `json:"httpsPort,omitempty"` + HostName *string `json:"hostName,omitempty"` + OriginHostHeader *string `json:"originHostHeader,omitempty"` + Priority *int64 `json:"priority,omitempty"` + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + PrivateLinkResourceId *string `json:"privateLinkResourceId,omitempty"` + Weight *int64 `json:"weight,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/predicates.go new file mode 100644 index 000000000000..2424013ceb9a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/predicates.go @@ -0,0 +1,27 @@ +package origins + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OriginOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p OriginOperationPredicate) Matches(input Origin) 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/origins/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/version.go new file mode 100644 index 000000000000..615b7e14a8ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/version.go @@ -0,0 +1,10 @@ +package origins + +// 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/origins/2024-02-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/README.md new file mode 100644 index 000000000000..9804b1c05f30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules` Documentation + +The `rules` 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/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-02-01/rules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/id_rule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/id_ruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/method_listbyruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_cacheconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_cacheexpirationactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_cachekeyquerystringactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_clientportmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_cookiesmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulecacheexpirationaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulecachekeyquerystringaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleclientportcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulecookiescondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulehostnamecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulehttpversioncondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleisdevicecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulepostargscondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulequerystringcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleremoteaddresscondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulerequestbodycondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulerequestheaderaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulerequestheadercondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulerequestmethodcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulerequestschemecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulerequesturicondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleresponseheaderaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleserverportcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulesocketaddrcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryrulesslprotocolcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleurlfileextensioncondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleurlfilenamecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_deliveryruleurlpathcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_headeractionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_hostnamematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_httpversionmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_isdevicematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_origingroupoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_origingroupoverrideaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_origingroupoverrideactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_postargsmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_querystringmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_remoteaddressmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_requestbodymatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_requestheadermatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_requestmethodmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_requestschemematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_requesturimatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_routeconfigurationoverrideactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_rule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_ruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_ruleupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_ruleupdatepropertiesparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_serverportmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_socketaddrmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_sslprotocolmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlfileextensionmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlfilenamematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlpathmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlredirectaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlredirectactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlrewriteaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlrewriteactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlsigningaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlsigningactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/model_urlsigningparamidentifier.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-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-02-01/rules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/version.go new file mode 100644 index 000000000000..5f6afc46572a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-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-02-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/rules/2024-02-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/README.md new file mode 100644 index 000000000000..c720624b8f61 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/README.md @@ -0,0 +1,98 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets` Documentation + +The `rulesets` 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/rulesets" +``` + + +### Client Initialization + +```go +client := rulesets.NewRuleSetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RuleSetsClient.Create` + +```go +ctx := context.TODO() +id := rulesets.NewRuleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName") + +read, err := client.Create(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RuleSetsClient.Delete` + +```go +ctx := context.TODO() +id := rulesets.NewRuleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RuleSetsClient.Get` + +```go +ctx := context.TODO() +id := rulesets.NewRuleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName") + +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: `RuleSetsClient.ListByProfile` + +```go +ctx := context.TODO() +id := rulesets.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: `RuleSetsClient.ListResourceUsage` + +```go +ctx := context.TODO() +id := rulesets.NewRuleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName") + +// 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 +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/client.go new file mode 100644 index 000000000000..957ddc082f19 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/client.go @@ -0,0 +1,26 @@ +package rulesets + +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 RuleSetsClient struct { + Client *resourcemanager.Client +} + +func NewRuleSetsClientWithBaseURI(sdkApi sdkEnv.Api) (*RuleSetsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "rulesets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RuleSetsClient: %+v", err) + } + + return &RuleSetsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/constants.go new file mode 100644 index 000000000000..4873ab357b07 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/constants.go @@ -0,0 +1,145 @@ +package rulesets + +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 UsageUnit string + +const ( + UsageUnitCount UsageUnit = "Count" +) + +func PossibleValuesForUsageUnit() []string { + return []string{ + string(UsageUnitCount), + } +} + +func (s *UsageUnit) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUsageUnit(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUsageUnit(input string) (*UsageUnit, error) { + vals := map[string]UsageUnit{ + "count": UsageUnitCount, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UsageUnit(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/id_profile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/id_profile.go new file mode 100644 index 000000000000..1b4dbd34e381 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/id_profile.go @@ -0,0 +1,130 @@ +package rulesets + +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/rulesets/id_ruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/id_ruleset.go new file mode 100644 index 000000000000..fe1b366d58f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/id_ruleset.go @@ -0,0 +1,139 @@ +package rulesets + +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-02-01/rulesets/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_create.go new file mode 100644 index 000000000000..25e6f40f5d15 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_create.go @@ -0,0 +1,54 @@ +package rulesets + +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 CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RuleSet +} + +// Create ... +func (c RuleSetsClient) Create(ctx context.Context, id RuleSetId) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + 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 RuleSet + 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/rulesets/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_delete.go new file mode 100644 index 000000000000..e0f00268a452 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_delete.go @@ -0,0 +1,71 @@ +package rulesets + +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 RuleSetsClient) Delete(ctx context.Context, id RuleSetId) (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 RuleSetsClient) DeleteThenPoll(ctx context.Context, id RuleSetId) 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/rulesets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_get.go new file mode 100644 index 000000000000..5ea1977123da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_get.go @@ -0,0 +1,53 @@ +package rulesets + +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 *RuleSet +} + +// Get ... +func (c RuleSetsClient) Get(ctx context.Context, id RuleSetId) (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 RuleSet + 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/rulesets/method_listbyprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_listbyprofile.go new file mode 100644 index 000000000000..3c04ee6d0a76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_listbyprofile.go @@ -0,0 +1,105 @@ +package rulesets + +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 *[]RuleSet +} + +type ListByProfileCompleteResult struct { + LatestHttpResponse *http.Response + Items []RuleSet +} + +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 RuleSetsClient) 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/ruleSets", 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 *[]RuleSet `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 RuleSetsClient) ListByProfileComplete(ctx context.Context, id ProfileId) (ListByProfileCompleteResult, error) { + return c.ListByProfileCompleteMatchingPredicate(ctx, id, RuleSetOperationPredicate{}) +} + +// ListByProfileCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RuleSetsClient) ListByProfileCompleteMatchingPredicate(ctx context.Context, id ProfileId, predicate RuleSetOperationPredicate) (result ListByProfileCompleteResult, err error) { + items := make([]RuleSet, 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/rulesets/method_listresourceusage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_listresourceusage.go new file mode 100644 index 000000000000..08a467d0bf52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/method_listresourceusage.go @@ -0,0 +1,105 @@ +package rulesets + +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 *[]Usage +} + +type ListResourceUsageCompleteResult struct { + LatestHttpResponse *http.Response + Items []Usage +} + +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 RuleSetsClient) ListResourceUsage(ctx context.Context, id RuleSetId) (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/usages", 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 *[]Usage `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 RuleSetsClient) ListResourceUsageComplete(ctx context.Context, id RuleSetId) (ListResourceUsageCompleteResult, error) { + return c.ListResourceUsageCompleteMatchingPredicate(ctx, id, UsageOperationPredicate{}) +} + +// ListResourceUsageCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RuleSetsClient) ListResourceUsageCompleteMatchingPredicate(ctx context.Context, id RuleSetId, predicate UsageOperationPredicate) (result ListResourceUsageCompleteResult, err error) { + items := make([]Usage, 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/rulesets/model_ruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_ruleset.go new file mode 100644 index 000000000000..318adf437299 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_ruleset.go @@ -0,0 +1,16 @@ +package rulesets + +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 RuleSet struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RuleSetProperties `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/rulesets/model_rulesetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_rulesetproperties.go new file mode 100644 index 000000000000..55b980e2c526 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_rulesetproperties.go @@ -0,0 +1,10 @@ +package rulesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RuleSetProperties struct { + DeploymentStatus *DeploymentStatus `json:"deploymentStatus,omitempty"` + ProfileName *string `json:"profileName,omitempty"` + ProvisioningState *AfdProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_usage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_usage.go new file mode 100644 index 000000000000..54f0c36919fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_usage.go @@ -0,0 +1,12 @@ +package rulesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Usage struct { + CurrentValue int64 `json:"currentValue"` + Id *string `json:"id,omitempty"` + Limit int64 `json:"limit"` + Name UsageName `json:"name"` + Unit UsageUnit `json:"unit"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_usagename.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_usagename.go new file mode 100644 index 000000000000..023a3d43d61a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/model_usagename.go @@ -0,0 +1,9 @@ +package rulesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageName struct { + LocalizedValue *string `json:"localizedValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/predicates.go new file mode 100644 index 000000000000..0d67bcef0831 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/predicates.go @@ -0,0 +1,50 @@ +package rulesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RuleSetOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RuleSetOperationPredicate) Matches(input RuleSet) 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 +} + +type UsageOperationPredicate struct { + CurrentValue *int64 + Id *string + Limit *int64 +} + +func (p UsageOperationPredicate) Matches(input Usage) bool { + + if p.CurrentValue != nil && *p.CurrentValue != input.CurrentValue { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Limit != nil && *p.Limit != input.Limit { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/version.go new file mode 100644 index 000000000000..f56a9e0c40c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets/version.go @@ -0,0 +1,10 @@ +package rulesets + +// 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/rulesets/2024-02-01" +} diff --git a/vendor/modules.txt b/vendor/modules.txt index a00e6eefd3fc..208331dec477 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -309,7 +309,10 @@ 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/origins 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/rules +github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets 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 From 7fe9e5dc28aaa70b2c71438b2cfa4ddc13282378 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Wed, 18 Dec 2024 02:23:34 -0700 Subject: [PATCH 2/3] Fixing delivery rule conditions adding a polymorphisim discriminator package... --- .../cdn/deliveryruleconditions/cookies.go | 15 +- .../delivery_rule_condition_discriminator.go | 135 ++++++++++++++++++ ...le_condition_polymorphism_discriminator.go | 46 ------ .../delivery_rule_conditions_helper.go | 96 ++++++++++++- .../cdn/deliveryruleconditions/device.go | 6 +- .../deliveryruleconditions/http_version.go | 2 + .../cdn/deliveryruleconditions/post_arg.go | 13 +- .../deliveryruleconditions/query_string.go | 56 +++----- .../deliveryruleconditions/remote_address.go | 30 ++-- .../deliveryruleconditions/request_body.go | 58 +++----- .../deliveryruleconditions/request_header.go | 59 +++----- .../deliveryruleconditions/request_method.go | 51 +++---- .../deliveryruleconditions/request_scheme.go | 47 +++--- .../cdn/deliveryruleconditions/request_uri.go | 55 +++---- .../url_file_extension.go | 56 +++----- .../deliveryruleconditions/url_file_name.go | 51 +++---- .../cdn/deliveryruleconditions/url_path.go | 52 +++---- 17 files changed, 433 insertions(+), 395 deletions(-) create mode 100644 internal/services/cdn/deliveryruleconditions/delivery_rule_condition_discriminator.go delete mode 100644 internal/services/cdn/deliveryruleconditions/delivery_rule_condition_polymorphism_discriminator.go diff --git a/internal/services/cdn/deliveryruleconditions/cookies.go b/internal/services/cdn/deliveryruleconditions/cookies.go index 90a36c49c6e2..26a6c44934ae 100644 --- a/internal/services/cdn/deliveryruleconditions/cookies.go +++ b/internal/services/cdn/deliveryruleconditions/cookies.go @@ -25,7 +25,6 @@ func Cookies() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForCookiesOperator(), false), }, @@ -65,6 +64,7 @@ func ExpandArmCdnEndpointConditionCookies(input []interface{}) []rules.DeliveryR output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) + cookiesCondition := rules.DeliveryRuleCookiesCondition{ Name: rules.MatchVariableCookies, Parameters: rules.CookiesMatchConditionParameters{ @@ -73,17 +73,10 @@ func ExpandArmCdnEndpointConditionCookies(input []interface{}) []rules.DeliveryR Operator: rules.CookiesOperator(item["operator"].(string)), NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + Transforms: expandTransforms(item["transforms"].([]interface{})), }, } - if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]rules.Transform, 0) - for _, t := range rawTransforms { - transforms = append(transforms, rules.Transform(t.(string))) - } - cookiesCondition.Parameters.Transforms = &transforms - } - output = append(output, cookiesCondition) } @@ -118,9 +111,7 @@ func FlattenArmCdnEndpointConditionCookies(input rules.DeliveryRuleCondition) (* } if params.Transforms != nil { - for _, transform := range *params.Transforms { - transforms = append(transforms, string(transform)) - } + transforms = flattenTransforms(params.Transforms) } } diff --git a/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_discriminator.go b/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_discriminator.go new file mode 100644 index 000000000000..5b5c937ddb03 --- /dev/null +++ b/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_discriminator.go @@ -0,0 +1,135 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package deliveryruleconditions + +import ( + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" +) + +func AsDeliveryRuleCookiesCondition(input rules.DeliveryRuleCondition) (*rules.CookiesMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableCookies { + return nil, false + } + + cookieParameter := rules.CookiesMatchConditionParameters{} + return pointer.To(cookieParameter), true +} + +func AsDeliveryRuleIsDeviceCondition(input rules.DeliveryRuleCondition) (*rules.IsDeviceMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableIsDevice { + return nil, false + } + + deviceParameter := rules.IsDeviceMatchConditionParameters{} + return pointer.To(deviceParameter), true +} + +func AsDeliveryRuleHTTPVersionCondition(input rules.DeliveryRuleCondition) (*rules.HTTPVersionMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableHTTPVersion { + return nil, false + } + + deviceParameter := rules.HTTPVersionMatchConditionParameters{} + return pointer.To(deviceParameter), true +} + +func AsDeliveryRulePostArgsCondition(input rules.DeliveryRuleCondition) (*rules.PostArgsMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariablePostArgs { + return nil, false + } + + postArgParameter := rules.PostArgsMatchConditionParameters{} + return pointer.To(postArgParameter), true +} + +func AsDeliveryRuleQueryStringCondition(input rules.DeliveryRuleCondition) (*rules.QueryStringMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableQueryString { + return nil, false + } + + postArgParameter := rules.QueryStringMatchConditionParameters{} + return pointer.To(postArgParameter), true +} + +func AsDeliveryRuleRemoteAddressCondition(input rules.DeliveryRuleCondition) (*rules.RemoteAddressMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableRemoteAddress { + return nil, false + } + + remoteAddressParameter := rules.RemoteAddressMatchConditionParameters{} + return pointer.To(remoteAddressParameter), true +} + +func AsDeliveryRuleRequestBodyCondition(input rules.DeliveryRuleCondition) (*rules.RequestBodyMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableRequestBody { + return nil, false + } + + requestBodyParameter := rules.RequestBodyMatchConditionParameters{} + return pointer.To(requestBodyParameter), true +} + +func AsDeliveryRuleRequestHeaderCondition(input rules.DeliveryRuleCondition) (*rules.RequestHeaderMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableRequestHeader { + return nil, false + } + + requestHeaderParameter := rules.RequestHeaderMatchConditionParameters{} + return pointer.To(requestHeaderParameter), true +} + +func AsDeliveryRuleRequestMethodCondition(input rules.DeliveryRuleCondition) (*rules.RequestMethodMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableRequestMethod { + return nil, false + } + + requestMethodParameter := rules.RequestMethodMatchConditionParameters{} + return pointer.To(requestMethodParameter), true +} + +func AsDeliveryRuleRequestSchemeCondition(input rules.DeliveryRuleCondition) (*rules.RequestSchemeMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableRequestScheme { + return nil, false + } + + requestSchemeParameter := rules.RequestSchemeMatchConditionParameters{} + return pointer.To(requestSchemeParameter), true +} + +func AsDeliveryRuleRequestUriCondition(input rules.DeliveryRuleCondition) (*rules.RequestUriMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableRequestUri { + return nil, false + } + + requestUriParameter := rules.RequestUriMatchConditionParameters{} + return pointer.To(requestUriParameter), true +} + +func AsDeliveryRuleURLFileExtensionCondition(input rules.DeliveryRuleCondition) (*rules.URLFileExtensionMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableURLFileExtension { + return nil, false + } + + urlFileExtensionParameter := rules.URLFileExtensionMatchConditionParameters{} + return pointer.To(urlFileExtensionParameter), true +} + +func AsDeliveryRuleURLFileNameCondition(input rules.DeliveryRuleCondition) (*rules.URLFileNameMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableURLFileName { + return nil, false + } + + urlFileNameParameter := rules.URLFileNameMatchConditionParameters{} + return pointer.To(urlFileNameParameter), true +} + +func AsDeliveryRuleURLPathCondition(input rules.DeliveryRuleCondition) (*rules.URLPathMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableURLPath { + return nil, false + } + + urlPathParameter := rules.URLPathMatchConditionParameters{} + return pointer.To(urlPathParameter), true +} diff --git a/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_polymorphism_discriminator.go b/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_polymorphism_discriminator.go deleted file mode 100644 index 8c9583929f8f..000000000000 --- a/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_polymorphism_discriminator.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package deliveryruleconditions - -import ( - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" -) - -func AsDeliveryRuleCookiesCondition(input rules.DeliveryRuleCondition) (*rules.CookiesMatchConditionParameters, bool) { - if input.DeliveryRuleCondition().Name != rules.MatchVariableCookies { - return nil, false - } - - cookieParameter := rules.CookiesMatchConditionParameters{} - return pointer.To(cookieParameter), true -} - -func AsDeliveryRuleIsDeviceCondition(input rules.DeliveryRuleCondition) (*rules.IsDeviceMatchConditionParameters, bool) { - if input.DeliveryRuleCondition().Name != rules.MatchVariableIsDevice { - return nil, false - } - - deviceParameter := rules.IsDeviceMatchConditionParameters{} - return pointer.To(deviceParameter), true -} - -func AsDeliveryRuleHTTPVersionCondition(input rules.DeliveryRuleCondition) (*rules.HTTPVersionMatchConditionParameters, bool) { - if input.DeliveryRuleCondition().Name != rules.MatchVariableHTTPVersion { - return nil, false - } - - deviceParameter := rules.HTTPVersionMatchConditionParameters{} - return pointer.To(deviceParameter), true -} - -// AsDeliveryRulePostArgsCondition -func AsDeliveryRulePostArgsCondition(input rules.DeliveryRuleCondition) (*rules.PostArgsMatchConditionParameters, bool) { - if input.DeliveryRuleCondition().Name != rules.MatchVariableHTTPVersion { - return nil, false - } - - postArgParameter := rules.PostArgsMatchConditionParameters{} - return pointer.To(postArgParameter), true -} diff --git a/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go b/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go index a2c6af729e5e..e0dda9178fba 100644 --- a/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go +++ b/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go @@ -7,22 +7,108 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" ) -func ExpandIsDeviceMatchValue(input []interface{}) *[]rules.IsDeviceMatchValue { +func expandTransforms(input []interface{}) *[]rules.Transform { + if len(input) == 0 { + return nil + } + + result := make([]rules.Transform, 0) + + if v := input; len(v) != 0 { + for _, t := range v { + result = append(result, rules.Transform(t.(string))) + } + + return &result + } + + return nil +} + +func flattenTransforms(input *[]rules.Transform) []string { + result := make([]string, 0) + if input == nil { + return result + } + + for _, transform := range *input { + result = append(result, string(transform)) + } + + return result +} + +func expandIsDeviceMatchValue(input []interface{}) *[]rules.IsDeviceMatchValue { result := make([]rules.IsDeviceMatchValue, 0) + for _, item := range input { if item != nil { result = append(result, rules.IsDeviceMatchValue(item.(string))) } } + + return &result +} + +func flattenIsDeviceMatchValue(input *[]rules.IsDeviceMatchValue) []interface{} { + result := make([]interface{}, 0) + if input == nil { + return result + } + + for _, item := range *input { + result = append(result, string(item)) + } + + return result +} + +func expandRequestMethodMatchValue(input []interface{}) *[]rules.RequestMethodMatchValue { + result := make([]rules.RequestMethodMatchValue, 0) + + for _, item := range input { + if item != nil { + result = append(result, rules.RequestMethodMatchValue(item.(string))) + } + } + return &result } -func FlattenIsDeviceMatchValue(input *[]rules.IsDeviceMatchValue) []interface{} { +func flattenRequestMethodMatchValue(input *[]rules.RequestMethodMatchValue) []interface{} { result := make([]interface{}, 0) - if input != nil { - for _, item := range *input { - result = append(result, string(item)) + if input == nil { + return result + } + + for _, item := range *input { + result = append(result, string(item)) + } + + return result +} + +func expandRequestSchemeMatchValue(input []interface{}) *[]rules.RequestSchemeMatchValue { + result := make([]rules.RequestSchemeMatchValue, 0) + + for _, item := range input { + if item != nil { + result = append(result, rules.RequestSchemeMatchValue(item.(string))) } } + + return &result +} + +func flattenRequestSchemeMatchValue(input *[]rules.RequestSchemeMatchValue) []interface{} { + result := make([]interface{}, 0) + if input == nil { + return result + } + + for _, item := range *input { + result = append(result, string(item)) + } + return result } diff --git a/internal/services/cdn/deliveryruleconditions/device.go b/internal/services/cdn/deliveryruleconditions/device.go index cb5a33e0ff86..7ddca6eb2923 100644 --- a/internal/services/cdn/deliveryruleconditions/device.go +++ b/internal/services/cdn/deliveryruleconditions/device.go @@ -48,13 +48,14 @@ func ExpandArmCdnEndpointConditionDevice(input []interface{}) []rules.DeliveryRu for _, v := range input { item := v.(map[string]interface{}) + output = append(output, rules.DeliveryRuleIsDeviceCondition{ Name: rules.MatchVariableIsDevice, Parameters: rules.IsDeviceMatchConditionParameters{ TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters, Operator: rules.IsDeviceOperator(item["operator"].(string)), NegateCondition: pointer.To(item["negate_condition"].(bool)), - MatchValues: ExpandIsDeviceMatchValue(item["match_values"].(*pluginsdk.Set).List()), + MatchValues: expandIsDeviceMatchValue(item["match_values"].(*pluginsdk.Set).List()), }, }) } @@ -71,6 +72,7 @@ func FlattenArmCdnEndpointConditionDevice(input rules.DeliveryRuleCondition) (*m operator := "" matchValues := make([]interface{}, 0) negateCondition := false + if params := condition; params != nil { operator = string(params.Operator) @@ -79,7 +81,7 @@ func FlattenArmCdnEndpointConditionDevice(input rules.DeliveryRuleCondition) (*m } if params.MatchValues != nil { - matchValues = FlattenIsDeviceMatchValue(params.MatchValues) + matchValues = flattenIsDeviceMatchValue(params.MatchValues) } } diff --git a/internal/services/cdn/deliveryruleconditions/http_version.go b/internal/services/cdn/deliveryruleconditions/http_version.go index 790bd2c3a99c..e3bf444e62ad 100644 --- a/internal/services/cdn/deliveryruleconditions/http_version.go +++ b/internal/services/cdn/deliveryruleconditions/http_version.go @@ -53,6 +53,7 @@ func ExpandArmCdnEndpointConditionHTTPVersion(input []interface{}) []rules.Deliv for _, v := range input { item := v.(map[string]interface{}) + output = append(output, rules.DeliveryRuleHTTPVersionCondition{ Name: rules.MatchVariableHTTPVersion, Parameters: rules.HTTPVersionMatchConditionParameters{ @@ -76,6 +77,7 @@ func FlattenArmCdnEndpointConditionHTTPVersion(input rules.DeliveryRuleCondition operator := "" matchValues := make([]interface{}, 0) negateCondition := false + if params := condition; params != nil { operator = string(params.Operator) diff --git a/internal/services/cdn/deliveryruleconditions/post_arg.go b/internal/services/cdn/deliveryruleconditions/post_arg.go index 7f7875e28e0f..fc91c1195fe5 100644 --- a/internal/services/cdn/deliveryruleconditions/post_arg.go +++ b/internal/services/cdn/deliveryruleconditions/post_arg.go @@ -74,17 +74,10 @@ func ExpandArmCdnEndpointConditionPostArg(input []interface{}) []rules.DeliveryR Operator: rules.PostArgsOperator(item["operator"].(string)), NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + Transforms: expandTransforms(item["transforms"].([]interface{})), }, } - if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]rules.Transform, 0) - for _, t := range rawTransforms { - transforms = append(transforms, rules.Transform(t.(string))) - } - condition.Parameters.Transforms = &transforms - } - output = append(output, condition) } @@ -119,9 +112,7 @@ func FlattenArmCdnEndpointConditionPostArg(input rules.DeliveryRuleCondition) (* } if params.Transforms != nil { - for _, transform := range *params.Transforms { - transforms = append(transforms, string(transform)) - } + transforms = flattenTransforms(params.Transforms) } } diff --git a/internal/services/cdn/deliveryruleconditions/query_string.go b/internal/services/cdn/deliveryruleconditions/query_string.go index 5fca2a857154..24c0c7f2052b 100644 --- a/internal/services/cdn/deliveryruleconditions/query_string.go +++ b/internal/services/cdn/deliveryruleconditions/query_string.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -18,17 +19,8 @@ func QueryString() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.QueryStringOperatorAny), - string(cdn.QueryStringOperatorBeginsWith), - string(cdn.QueryStringOperatorContains), - string(cdn.QueryStringOperatorEndsWith), - string(cdn.QueryStringOperatorEqual), - string(cdn.QueryStringOperatorGreaterThan), - string(cdn.QueryStringOperatorGreaterThanOrEqual), - string(cdn.QueryStringOperatorLessThan), - string(cdn.QueryStringOperatorLessThanOrEqual), - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForQueryStringOperator(), + false), }, "negate_condition": { @@ -53,8 +45,8 @@ func QueryString() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformUppercase), + string(rules.TransformLowercase), + string(rules.TransformUppercase), }, false), }, }, @@ -62,38 +54,31 @@ func QueryString() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionQueryString(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionQueryString(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - queryStringCondition := cdn.DeliveryRuleQueryStringCondition{ - Name: cdn.NameQueryString, - Parameters: &cdn.QueryStringMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleQueryStringConditionParameters"), - Operator: cdn.QueryStringOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + queryStringCondition := rules.DeliveryRuleQueryStringCondition{ + Name: rules.MatchVariableQueryString, + Parameters: rules.QueryStringMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleQueryStringConditionParameters, + Operator: rules.QueryStringOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + Transforms: expandTransforms(item["transforms"].([]interface{})), }, } - if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]cdn.Transform, 0) - for _, t := range rawTransforms { - transforms = append(transforms, cdn.Transform(t.(string))) - } - queryStringCondition.Parameters.Transforms = &transforms - } - output = append(output, queryStringCondition) } return output } -func FlattenArmCdnEndpointConditionQueryString(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleQueryStringCondition() +func FlattenArmCdnEndpointConditionQueryString(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleQueryStringCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule query string condition") } @@ -102,7 +87,8 @@ func FlattenArmCdnEndpointConditionQueryString(input cdn.BasicDeliveryRuleCondit matchValues := make([]interface{}, 0) negateCondition := false transforms := make([]string, 0) - if params := condition.Parameters; params != nil { + + if params := condition; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -114,9 +100,7 @@ func FlattenArmCdnEndpointConditionQueryString(input cdn.BasicDeliveryRuleCondit } if params.Transforms != nil { - for _, transform := range *params.Transforms { - transforms = append(transforms, string(transform)) - } + transforms = flattenTransforms(params.Transforms) } } diff --git a/internal/services/cdn/deliveryruleconditions/remote_address.go b/internal/services/cdn/deliveryruleconditions/remote_address.go index 73b037efb743..263afee71a1b 100644 --- a/internal/services/cdn/deliveryruleconditions/remote_address.go +++ b/internal/services/cdn/deliveryruleconditions/remote_address.go @@ -6,7 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -18,11 +18,8 @@ func RemoteAddress() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.RemoteAddressOperatorAny), - string(cdn.RemoteAddressOperatorGeoMatch), - string(cdn.RemoteAddressOperatorIPMatch), - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRemoteAddressOperator(), + false), }, "negate_condition": { @@ -44,17 +41,17 @@ func RemoteAddress() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionRemoteAddress(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRemoteAddress(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - output = append(output, cdn.DeliveryRuleRemoteAddressCondition{ - Name: cdn.NameRemoteAddress, - Parameters: &cdn.RemoteAddressMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRemoteAddressConditionParameters"), - Operator: cdn.RemoteAddressOperator(item["operator"].(string)), + output = append(output, rules.DeliveryRuleRemoteAddressCondition{ + Name: rules.MatchVariableRemoteAddress, + Parameters: rules.RemoteAddressMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRemoteAddressConditionParameters, + Operator: rules.RemoteAddressOperator(item["operator"].(string)), NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, @@ -64,8 +61,8 @@ func ExpandArmCdnEndpointConditionRemoteAddress(input []interface{}) []cdn.Basic return output } -func FlattenArmCdnEndpointConditionRemoteAddress(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRemoteAddressCondition() +func FlattenArmCdnEndpointConditionRemoteAddress(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleRemoteAddressCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule address condition") } @@ -73,7 +70,8 @@ func FlattenArmCdnEndpointConditionRemoteAddress(input cdn.BasicDeliveryRuleCond operator := "" negateCondition := false matchValues := make([]interface{}, 0) - if params := condition.Parameters; params != nil { + + if params := condition; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { diff --git a/internal/services/cdn/deliveryruleconditions/request_body.go b/internal/services/cdn/deliveryruleconditions/request_body.go index 3ab69b6be9c5..dd487ad1a90d 100644 --- a/internal/services/cdn/deliveryruleconditions/request_body.go +++ b/internal/services/cdn/deliveryruleconditions/request_body.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -18,17 +19,8 @@ func RequestBody() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.RequestBodyOperatorAny), - string(cdn.RequestBodyOperatorBeginsWith), - string(cdn.RequestBodyOperatorContains), - string(cdn.RequestBodyOperatorEndsWith), - string(cdn.RequestBodyOperatorEqual), - string(cdn.RequestBodyOperatorGreaterThan), - string(cdn.RequestBodyOperatorGreaterThanOrEqual), - string(cdn.RequestBodyOperatorLessThan), - string(cdn.RequestBodyOperatorLessThanOrEqual), - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestBodyOperator(), + false), }, "negate_condition": { @@ -53,8 +45,8 @@ func RequestBody() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformUppercase), + string(rules.TransformLowercase), + string(rules.TransformUppercase), }, false), }, }, @@ -62,38 +54,31 @@ func RequestBody() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionRequestBody(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestBody(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - queryStringCondition := cdn.DeliveryRuleRequestBodyCondition{ - Name: cdn.NameRequestBody, - Parameters: &cdn.RequestBodyMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestBodyConditionParameters"), - Operator: cdn.RequestBodyOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + requestBodyCondition := rules.DeliveryRuleRequestBodyCondition{ + Name: rules.MatchVariableRequestBody, + Parameters: rules.RequestBodyMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestBodyConditionParameters, + Operator: rules.RequestBodyOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + Transforms: expandTransforms(item["transforms"].([]interface{})), }, } - if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]cdn.Transform, 0) - for _, t := range rawTransforms { - transforms = append(transforms, cdn.Transform(t.(string))) - } - queryStringCondition.Parameters.Transforms = &transforms - } - - output = append(output, queryStringCondition) + output = append(output, requestBodyCondition) } return output } -func FlattenArmCdnEndpointConditionRequestBody(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestBodyCondition() +func FlattenArmCdnEndpointConditionRequestBody(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleRequestBodyCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request body condition") } @@ -102,7 +87,8 @@ func FlattenArmCdnEndpointConditionRequestBody(input cdn.BasicDeliveryRuleCondit matchValues := make([]interface{}, 0) negateCondition := false transforms := make([]string, 0) - if params := condition.Parameters; params != nil { + + if params := condition; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -114,9 +100,7 @@ func FlattenArmCdnEndpointConditionRequestBody(input cdn.BasicDeliveryRuleCondit } if params.Transforms != nil { - for _, transform := range *params.Transforms { - transforms = append(transforms, string(transform)) - } + transforms = flattenTransforms(params.Transforms) } } diff --git a/internal/services/cdn/deliveryruleconditions/request_header.go b/internal/services/cdn/deliveryruleconditions/request_header.go index 47aa0c2cee45..c89c7ac11add 100644 --- a/internal/services/cdn/deliveryruleconditions/request_header.go +++ b/internal/services/cdn/deliveryruleconditions/request_header.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -24,17 +25,8 @@ func RequestHeader() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.RequestHeaderOperatorAny), - string(cdn.RequestHeaderOperatorBeginsWith), - string(cdn.RequestHeaderOperatorContains), - string(cdn.RequestHeaderOperatorEndsWith), - string(cdn.RequestHeaderOperatorEqual), - string(cdn.RequestHeaderOperatorGreaterThan), - string(cdn.RequestHeaderOperatorGreaterThanOrEqual), - string(cdn.RequestHeaderOperatorLessThan), - string(cdn.RequestHeaderOperatorLessThanOrEqual), - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestHeaderOperator(), + false), }, "negate_condition": { @@ -59,8 +51,8 @@ func RequestHeader() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformUppercase), + string(rules.TransformLowercase), + string(rules.TransformUppercase), }, false), }, }, @@ -68,38 +60,32 @@ func RequestHeader() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionRequestHeader(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestHeader(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestHeaderCondition := cdn.DeliveryRuleRequestHeaderCondition{ - Name: cdn.NameRequestHeader, - Parameters: &cdn.RequestHeaderMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestHeaderConditionParameters"), - Selector: utils.String(item["selector"].(string)), - Operator: cdn.RequestHeaderOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + + requestHeaderCondition := rules.DeliveryRuleRequestHeaderCondition{ + Name: rules.MatchVariableRequestHeader, + Parameters: rules.RequestHeaderMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestHeaderConditionParameters, + Selector: pointer.To(item["selector"].(string)), + Operator: rules.RequestHeaderOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + Transforms: expandTransforms(item["transforms"].([]interface{})), }, } - if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]cdn.Transform, 0) - for _, t := range rawTransforms { - transforms = append(transforms, cdn.Transform(t.(string))) - } - requestHeaderCondition.Parameters.Transforms = &transforms - } - output = append(output, requestHeaderCondition) } return output } -func FlattenArmCdnEndpointConditionRequestHeader(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestHeaderCondition() +func FlattenArmCdnEndpointConditionRequestHeader(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleRequestHeaderCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request header condition") } @@ -109,7 +95,8 @@ func FlattenArmCdnEndpointConditionRequestHeader(input cdn.BasicDeliveryRuleCond matchValues := make([]interface{}, 0) negateCondition := false transforms := make([]string, 0) - if params := condition.Parameters; params != nil { + + if params := condition; params != nil { if params.Selector != nil { selector = *params.Selector } @@ -125,9 +112,7 @@ func FlattenArmCdnEndpointConditionRequestHeader(input cdn.BasicDeliveryRuleCond } if params.Transforms != nil { - for _, transform := range *params.Transforms { - transforms = append(transforms, string(transform)) - } + transforms = flattenTransforms(params.Transforms) } } diff --git a/internal/services/cdn/deliveryruleconditions/request_method.go b/internal/services/cdn/deliveryruleconditions/request_method.go index 5a7b3e3a0c8c..0885c6261788 100644 --- a/internal/services/cdn/deliveryruleconditions/request_method.go +++ b/internal/services/cdn/deliveryruleconditions/request_method.go @@ -6,10 +6,10 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func RequestMethod() *pluginsdk.Resource { @@ -19,9 +19,8 @@ func RequestMethod() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Default: "Equal", - ValidateFunc: validation.StringInSlice([]string{ - "Equal", - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestMethodOperator(), + false), }, "negate_condition": { @@ -36,32 +35,27 @@ func RequestMethod() *pluginsdk.Resource { MinItems: 1, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice([]string{ - "DELETE", - "GET", - "HEAD", - "OPTIONS", - "POST", - "PUT", - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestMethodMatchValue(), + false), }, }, }, } } -func ExpandArmCdnEndpointConditionRequestMethod(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestMethod(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - output = append(output, cdn.DeliveryRuleRequestMethodCondition{ - Name: cdn.NameRequestMethod, - Parameters: &cdn.RequestMethodMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestMethodConditionParameters"), - Operator: utils.String(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), - MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + + output = append(output, rules.DeliveryRuleRequestMethodCondition{ + Name: rules.MatchVariableRequestMethod, + Parameters: rules.RequestMethodMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters, + Operator: rules.RequestMethodOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), + MatchValues: expandRequestMethodMatchValue(item["match_values"].(*pluginsdk.Set).List()), }, }) } @@ -69,8 +63,8 @@ func ExpandArmCdnEndpointConditionRequestMethod(input []interface{}) []cdn.Basic return output } -func FlattenArmCdnEndpointConditionRequestMethod(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestMethodCondition() +func FlattenArmCdnEndpointConditionRequestMethod(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleRequestMethodCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request method condition") } @@ -78,17 +72,16 @@ func FlattenArmCdnEndpointConditionRequestMethod(input cdn.BasicDeliveryRuleCond operator := "" negateCondition := false matchValues := make([]interface{}, 0) - if params := condition.Parameters; params != nil { - if params.Operator != nil { - operator = *params.Operator - } + + if params := condition; params != nil { + operator = string(params.Operator) if params.NegateCondition != nil { negateCondition = *params.NegateCondition } if params.MatchValues != nil { - matchValues = utils.FlattenStringSlice(params.MatchValues) + matchValues = flattenRequestMethodMatchValue(params.MatchValues) } } diff --git a/internal/services/cdn/deliveryruleconditions/request_scheme.go b/internal/services/cdn/deliveryruleconditions/request_scheme.go index 345435dfdf24..2a2a68a1e4b6 100644 --- a/internal/services/cdn/deliveryruleconditions/request_scheme.go +++ b/internal/services/cdn/deliveryruleconditions/request_scheme.go @@ -6,10 +6,10 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func RequestScheme() *pluginsdk.Resource { @@ -18,9 +18,9 @@ func RequestScheme() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Optional: true, - Default: "Equal", + Default: string(rules.OperatorEqual), ValidateFunc: validation.StringInSlice([]string{ - "Equal", + string(rules.OperatorEqual), }, false), }, @@ -36,43 +36,38 @@ func RequestScheme() *pluginsdk.Resource { MinItems: 1, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice([]string{ - "HTTP", - "HTTPS", - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestSchemeMatchValue(), + false), }, }, }, } } -func ExpandArmCdnEndpointConditionRequestScheme(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestScheme(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestSchemeCondition := cdn.DeliveryRuleRequestSchemeCondition{ - Name: cdn.NameRequestScheme, - Parameters: &cdn.RequestSchemeMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestSchemeConditionParameters"), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), - MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + requestSchemeCondition := rules.DeliveryRuleRequestSchemeCondition{ + Name: rules.MatchVariableRequestScheme, + Parameters: rules.RequestSchemeMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestSchemeConditionParameters, + Operator: rules.Operator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), + MatchValues: expandRequestSchemeMatchValue(item["match_values"].(*pluginsdk.Set).List()), }, } - if operator := item["operator"]; operator.(string) != "" { - requestSchemeCondition.Parameters.Operator = utils.String(operator.(string)) - } - output = append(output, requestSchemeCondition) } return output } -func FlattenArmCdnEndpointConditionRequestScheme(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestSchemeCondition() +func FlattenArmCdnEndpointConditionRequestScheme(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleRequestSchemeCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request scheme condition") } @@ -80,17 +75,15 @@ func FlattenArmCdnEndpointConditionRequestScheme(input cdn.BasicDeliveryRuleCond operator := "" negateCondition := false matchValues := make([]interface{}, 0) - if params := condition.Parameters; params != nil { - if params.Operator != nil { - operator = *params.Operator - } + if params := condition; params != nil { + operator = string(params.Operator) if params.NegateCondition != nil { negateCondition = *params.NegateCondition } if params.MatchValues != nil { - matchValues = utils.FlattenStringSlice(params.MatchValues) + matchValues = flattenRequestSchemeMatchValue(params.MatchValues) } } diff --git a/internal/services/cdn/deliveryruleconditions/request_uri.go b/internal/services/cdn/deliveryruleconditions/request_uri.go index afd19b239530..5c7d530f5d0c 100644 --- a/internal/services/cdn/deliveryruleconditions/request_uri.go +++ b/internal/services/cdn/deliveryruleconditions/request_uri.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -18,17 +19,8 @@ func RequestURI() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.RequestURIOperatorAny), - string(cdn.RequestURIOperatorBeginsWith), - string(cdn.RequestURIOperatorContains), - string(cdn.RequestURIOperatorEndsWith), - string(cdn.RequestURIOperatorEqual), - string(cdn.RequestURIOperatorGreaterThan), - string(cdn.RequestURIOperatorGreaterThanOrEqual), - string(cdn.RequestURIOperatorLessThan), - string(cdn.RequestURIOperatorLessThanOrEqual), - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestUriOperator(), + false), }, "negate_condition": { @@ -53,8 +45,8 @@ func RequestURI() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformUppercase), + string(rules.TransformLowercase), + string(rules.TransformUppercase), }, false), }, }, @@ -62,37 +54,30 @@ func RequestURI() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionRequestURI(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestURI(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestURICondition := cdn.DeliveryRuleRequestURICondition{ - Name: cdn.NameRequestURI, - Parameters: &cdn.RequestURIMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestUriConditionParameters"), - Operator: cdn.RequestURIOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + requestURICondition := rules.DeliveryRuleRequestUriCondition{ + Name: rules.MatchVariableRequestUri, + Parameters: rules.RequestUriMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestUriConditionParameters, + Operator: rules.RequestUriOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + Transforms: expandTransforms(item["transforms"].([]interface{})), }, } - if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]cdn.Transform, 0) - for _, t := range rawTransforms { - transforms = append(transforms, cdn.Transform(t.(string))) - } - requestURICondition.Parameters.Transforms = &transforms - } - output = append(output, requestURICondition) } return output } -func FlattenArmCdnEndpointConditionRequestURI(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestURICondition() +func FlattenArmCdnEndpointConditionRequestURI(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleRequestUriCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request uri condition") } @@ -101,7 +86,7 @@ func FlattenArmCdnEndpointConditionRequestURI(input cdn.BasicDeliveryRuleConditi negateCondition := false operator := "" transforms := make([]string, 0) - if params := condition.Parameters; params != nil { + if params := condition; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -113,9 +98,7 @@ func FlattenArmCdnEndpointConditionRequestURI(input cdn.BasicDeliveryRuleConditi } if params.Transforms != nil { - for _, transform := range *params.Transforms { - transforms = append(transforms, string(transform)) - } + transforms = flattenTransforms(params.Transforms) } } diff --git a/internal/services/cdn/deliveryruleconditions/url_file_extension.go b/internal/services/cdn/deliveryruleconditions/url_file_extension.go index 73516981ba3b..9765800cb183 100644 --- a/internal/services/cdn/deliveryruleconditions/url_file_extension.go +++ b/internal/services/cdn/deliveryruleconditions/url_file_extension.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -18,17 +19,8 @@ func URLFileExtension() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.URLFileExtensionOperatorAny), - string(cdn.URLFileExtensionOperatorBeginsWith), - string(cdn.URLFileExtensionOperatorContains), - string(cdn.URLFileExtensionOperatorEndsWith), - string(cdn.URLFileExtensionOperatorEqual), - string(cdn.URLFileExtensionOperatorGreaterThan), - string(cdn.URLFileExtensionOperatorGreaterThanOrEqual), - string(cdn.URLFileExtensionOperatorLessThan), - string(cdn.URLFileExtensionOperatorLessThanOrEqual), - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForURLFileExtensionOperator(), + false), }, "negate_condition": { @@ -53,8 +45,8 @@ func URLFileExtension() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformUppercase), + string(rules.TransformLowercase), + string(rules.TransformUppercase), }, false), }, }, @@ -62,38 +54,31 @@ func URLFileExtension() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionURLFileExtension(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionURLFileExtension(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestURICondition := cdn.DeliveryRuleURLFileExtensionCondition{ - Name: cdn.NameURLFileExtension, - Parameters: &cdn.URLFileExtensionMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFileExtensionMatchConditionParameters"), - Operator: cdn.URLFileExtensionOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + requestURICondition := rules.DeliveryRuleURLFileExtensionCondition{ + Name: rules.MatchVariableURLFileExtension, + Parameters: rules.URLFileExtensionMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters, + Operator: rules.URLFileExtensionOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + Transforms: expandTransforms(item["transforms"].([]interface{})), }, } - if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]cdn.Transform, 0) - for _, t := range rawTransforms { - transforms = append(transforms, cdn.Transform(t.(string))) - } - requestURICondition.Parameters.Transforms = &transforms - } - output = append(output, requestURICondition) } return output } -func FlattenArmCdnEndpointConditionURLFileExtension(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleURLFileExtensionCondition() +func FlattenArmCdnEndpointConditionURLFileExtension(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleURLFileExtensionCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule url file extension condition") } @@ -102,7 +87,8 @@ func FlattenArmCdnEndpointConditionURLFileExtension(input cdn.BasicDeliveryRuleC negateCondition := false operator := "" transforms := make([]string, 0) - if params := condition.Parameters; params != nil { + + if params := condition; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -114,9 +100,7 @@ func FlattenArmCdnEndpointConditionURLFileExtension(input cdn.BasicDeliveryRuleC } if params.Transforms != nil { - for _, transform := range *params.Transforms { - transforms = append(transforms, string(transform)) - } + transforms = flattenTransforms(params.Transforms) } } diff --git a/internal/services/cdn/deliveryruleconditions/url_file_name.go b/internal/services/cdn/deliveryruleconditions/url_file_name.go index 20a87e1a53a6..12791165c596 100644 --- a/internal/services/cdn/deliveryruleconditions/url_file_name.go +++ b/internal/services/cdn/deliveryruleconditions/url_file_name.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -18,17 +19,8 @@ func URLFileName() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.URLFileNameOperatorAny), - string(cdn.URLFileNameOperatorBeginsWith), - string(cdn.URLFileNameOperatorContains), - string(cdn.URLFileNameOperatorEndsWith), - string(cdn.URLFileNameOperatorEqual), - string(cdn.URLFileNameOperatorGreaterThan), - string(cdn.URLFileNameOperatorGreaterThanOrEqual), - string(cdn.URLFileNameOperatorLessThan), - string(cdn.URLFileNameOperatorLessThanOrEqual), - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForURLFileNameOperator(), + false), }, "negate_condition": { @@ -53,8 +45,8 @@ func URLFileName() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformUppercase), + string(rules.TransformLowercase), + string(rules.TransformUppercase), }, false), }, }, @@ -62,38 +54,31 @@ func URLFileName() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionURLFileName(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionURLFileName(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestURICondition := cdn.DeliveryRuleURLFileNameCondition{ - Name: cdn.NameURLFileName, - Parameters: &cdn.URLFileNameMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFilenameConditionParameters"), - Operator: cdn.URLFileNameOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + requestURICondition := rules.DeliveryRuleURLFileNameCondition{ + Name: rules.MatchVariableURLFileName, + Parameters: rules.URLFileNameMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters, + Operator: rules.URLFileNameOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), + Transforms: expandTransforms(item["transforms"].([]interface{})), }, } - if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]cdn.Transform, 0) - for _, t := range rawTransforms { - transforms = append(transforms, cdn.Transform(t.(string))) - } - requestURICondition.Parameters.Transforms = &transforms - } - output = append(output, requestURICondition) } return output } -func FlattenArmCdnEndpointConditionURLFileName(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleURLFileNameCondition() +func FlattenArmCdnEndpointConditionURLFileName(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleURLFileNameCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule url file name condition") } @@ -102,7 +87,7 @@ func FlattenArmCdnEndpointConditionURLFileName(input cdn.BasicDeliveryRuleCondit negateCondition := false operator := "" transforms := make([]string, 0) - if params := condition.Parameters; params != nil { + if params := condition; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { diff --git a/internal/services/cdn/deliveryruleconditions/url_path.go b/internal/services/cdn/deliveryruleconditions/url_path.go index f9f8413e6c6e..731b972c2e3a 100644 --- a/internal/services/cdn/deliveryruleconditions/url_path.go +++ b/internal/services/cdn/deliveryruleconditions/url_path.go @@ -6,7 +6,8 @@ package deliveryruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -18,19 +19,8 @@ func URLPath() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.URLPathOperatorAny), - string(cdn.URLPathOperatorBeginsWith), - string(cdn.URLPathOperatorContains), - string(cdn.URLPathOperatorEndsWith), - string(cdn.URLPathOperatorEqual), - string(cdn.URLPathOperatorGreaterThan), - string(cdn.URLPathOperatorGreaterThanOrEqual), - string(cdn.URLPathOperatorLessThan), - string(cdn.URLPathOperatorLessThanOrEqual), - string(cdn.URLPathOperatorRegEx), - string(cdn.URLPathOperatorWildcard), - }, false), + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForURLPathOperator(), + false), }, "negate_condition": { @@ -55,8 +45,8 @@ func URLPath() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(cdn.TransformLowercase), - string(cdn.TransformUppercase), + string(rules.TransformLowercase), + string(rules.TransformUppercase), }, false), }, }, @@ -64,26 +54,26 @@ func URLPath() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionURLPath(input []interface{}) []cdn.BasicDeliveryRuleCondition { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionURLPath(input []interface{}) []rules.DeliveryRuleCondition { + output := make([]rules.DeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestURICondition := cdn.DeliveryRuleURLPathCondition{ - Name: cdn.NameURLPath, - Parameters: &cdn.URLPathMatchConditionParameters{ - OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleUrlPathMatchConditionParameters"), - Operator: cdn.URLPathOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + requestURICondition := rules.DeliveryRuleURLPathCondition{ + Name: rules.MatchVariableURLPath, + Parameters: rules.URLPathMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleURLPathMatchConditionParameters, + Operator: rules.URLPathOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, } if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]cdn.Transform, 0) + transforms := make([]rules.Transform, 0) for _, t := range rawTransforms { - transforms = append(transforms, cdn.Transform(t.(string))) + transforms = append(transforms, rules.Transform(t.(string))) } requestURICondition.Parameters.Transforms = &transforms } @@ -94,8 +84,8 @@ func ExpandArmCdnEndpointConditionURLPath(input []interface{}) []cdn.BasicDelive return output } -func FlattenArmCdnEndpointConditionURLPath(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleURLPathCondition() +func FlattenArmCdnEndpointConditionURLPath(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := AsDeliveryRuleURLPathCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule url path condition") } @@ -104,7 +94,7 @@ func FlattenArmCdnEndpointConditionURLPath(input cdn.BasicDeliveryRuleCondition) negateCondition := false operator := "" transforms := make([]string, 0) - if params := condition.Parameters; params != nil { + if params := condition; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -116,9 +106,7 @@ func FlattenArmCdnEndpointConditionURLPath(input cdn.BasicDeliveryRuleCondition) } if params.Transforms != nil { - for _, transform := range *params.Transforms { - transforms = append(transforms, string(transform)) - } + flattenTransforms(params.Transforms) } } From 5c36ca931b9c1e753a56c64d16102d8faabb4421 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Sun, 29 Dec 2024 02:56:25 -0700 Subject: [PATCH 3/3] Progress... --- .../cdn/cdn_frontdoor_rule_resource.go | 71 +- .../cdn/deliveryruleconditions/cookies.go | 62 +- .../delivery_rule_conditions_helper.go | 114 - .../cdn/deliveryruleconditions/device.go | 49 +- .../deliveryruleconditions/http_version.go | 38 +- .../cdn/deliveryruleconditions/post_arg.go | 57 +- .../deliveryruleconditions/query_string.go | 56 +- .../deliveryruleconditions/remote_address.go | 30 +- .../deliveryruleconditions/request_body.go | 58 +- .../deliveryruleconditions/request_header.go | 59 +- .../deliveryruleconditions/request_method.go | 51 +- .../deliveryruleconditions/request_scheme.go | 47 +- .../cdn/deliveryruleconditions/request_uri.go | 55 +- .../url_file_extension.go | 56 +- .../deliveryruleconditions/url_file_name.go | 51 +- .../cdn/deliveryruleconditions/url_path.go | 52 +- .../delivery_rule_action_discriminator.go | 63 + .../delivery_rule_condition_discriminator.go | 53 +- .../cdn_frontdoor_rule_conditions.go | 652 ++-- .../front_door_route_https_redirect.go | 4 +- .../front_door_security_policy_domain_id.go | 14 +- .../validate/front_door_validation_helpers.go | 15 +- .../cdn/2024-02-01/endpoints/README.md | 195 ++ .../cdn/2024-02-01/endpoints/client.go | 26 + .../cdn/2024-02-01/endpoints/constants.go | 2629 +++++++++++++++++ .../cdn/2024-02-01/endpoints/id_endpoint.go | 139 + .../cdn/2024-02-01/endpoints/id_profile.go | 130 + .../cdn/2024-02-01/endpoints/method_create.go | 76 + .../cdn/2024-02-01/endpoints/method_delete.go | 71 + .../cdn/2024-02-01/endpoints/method_get.go | 53 + .../endpoints/method_listbyprofile.go | 105 + .../endpoints/method_listresourceusage.go | 105 + .../endpoints/method_loadcontent.go | 74 + .../endpoints/method_purgecontent.go | 74 + .../cdn/2024-02-01/endpoints/method_start.go | 71 + .../cdn/2024-02-01/endpoints/method_stop.go | 71 + .../cdn/2024-02-01/endpoints/method_update.go | 75 + .../endpoints/method_validatecustomdomain.go | 58 + .../endpoints/model_cacheconfiguration.go | 12 + .../model_cacheexpirationactionparameters.go | 52 + ...del_cachekeyquerystringactionparameters.go | 51 + ...odel_clientportmatchconditionparameters.go | 53 + .../model_cookiesmatchconditionparameters.go | 54 + .../model_deepcreatedcustomdomain.go | 9 + ...model_deepcreatedcustomdomainproperties.go | 9 + .../endpoints/model_deepcreatedorigin.go | 9 + .../endpoints/model_deepcreatedorigingroup.go | 9 + .../model_deepcreatedorigingroupproperties.go | 11 + .../model_deepcreatedoriginproperties.go | 19 + .../endpoints/model_deliveryrule.go | 72 + .../endpoints/model_deliveryruleaction.go | 139 + .../model_deliveryruleactionparameters.go | 131 + ...model_deliveryrulecacheexpirationaction.go | 50 + ...l_deliveryrulecachekeyquerystringaction.go | 50 + .../model_deliveryruleclientportcondition.go | 50 + .../endpoints/model_deliveryrulecondition.go | 219 ++ .../model_deliveryruleconditionparameters.go | 219 ++ .../model_deliveryrulecookiescondition.go | 50 + .../model_deliveryrulehostnamecondition.go | 50 + .../model_deliveryrulehttpversioncondition.go | 50 + .../model_deliveryruleisdevicecondition.go | 50 + .../model_deliveryrulepostargscondition.go | 50 + .../model_deliveryrulequerystringcondition.go | 50 + ...odel_deliveryruleremoteaddresscondition.go | 50 + .../model_deliveryrulerequestbodycondition.go | 50 + .../model_deliveryrulerequestheaderaction.go | 50 + ...odel_deliveryrulerequestheadercondition.go | 50 + ...odel_deliveryrulerequestmethodcondition.go | 50 + ...odel_deliveryrulerequestschemecondition.go | 50 + .../model_deliveryrulerequesturicondition.go | 50 + .../model_deliveryruleresponseheaderaction.go | 50 + ...eryrulerouteconfigurationoverrideaction.go | 50 + .../model_deliveryruleserverportcondition.go | 50 + .../model_deliveryrulesocketaddrcondition.go | 50 + .../model_deliveryrulesslprotocolcondition.go | 50 + ...l_deliveryruleurlfileextensioncondition.go | 50 + .../model_deliveryruleurlfilenamecondition.go | 50 + .../model_deliveryruleurlpathcondition.go | 50 + .../2024-02-01/endpoints/model_endpoint.go | 18 + .../endpoints/model_endpointproperties.go | 27 + ...odel_endpointpropertiesupdateparameters.go | 21 + ...ropertiesupdateparametersdeliverypolicy.go | 9 + ...ameterswebapplicationfirewallpolicylink.go | 8 + .../model_endpointupdateparameters.go | 9 + .../2024-02-01/endpoints/model_geofilter.go | 10 + .../endpoints/model_headeractionparameters.go | 52 + .../endpoints/model_healthprobeparameters.go | 11 + .../model_hostnamematchconditionparameters.go | 53 + .../model_httperrorrangeparameters.go | 9 + ...del_httpversionmatchconditionparameters.go | 53 + .../model_isdevicematchconditionparameters.go | 53 + .../model_keyvaultsigningkeyparameters.go | 13 + .../endpoints/model_loadparameters.go | 8 + .../endpoints/model_origingroupoverride.go | 9 + .../model_origingroupoverrideaction.go | 50 + ...del_origingroupoverrideactionparameters.go | 50 + .../model_postargsmatchconditionparameters.go | 54 + .../endpoints/model_purgeparameters.go | 8 + ...del_querystringmatchconditionparameters.go | 53 + ...l_remoteaddressmatchconditionparameters.go | 53 + ...del_requestbodymatchconditionparameters.go | 53 + ...l_requestheadermatchconditionparameters.go | 54 + ...l_requestmethodmatchconditionparameters.go | 53 + ...l_requestschemematchconditionparameters.go | 53 + ...odel_requesturimatchconditionparameters.go | 53 + .../endpoints/model_resourcereference.go | 8 + .../endpoints/model_resourceusage.go | 11 + ...onsebasedoriginerrordetectionparameters.go | 10 + ...teconfigurationoverrideactionparameters.go | 51 + ...odel_serverportmatchconditionparameters.go | 53 + ...odel_socketaddrmatchconditionparameters.go | 53 + ...del_sslprotocolmatchconditionparameters.go | 53 + ...rlfileextensionmatchconditionparameters.go | 53 + ...del_urlfilenamematchconditionparameters.go | 53 + .../model_urlpathmatchconditionparameters.go | 53 + .../endpoints/model_urlredirectaction.go | 50 + .../model_urlredirectactionparameters.go | 55 + .../endpoints/model_urlrewriteaction.go | 50 + .../model_urlrewriteactionparameters.go | 52 + .../endpoints/model_urlsigningaction.go | 50 + .../model_urlsigningactionparameters.go | 51 + .../endpoints/model_urlsigningkey.go | 9 + .../model_urlsigningparamidentifier.go | 9 + .../model_validatecustomdomaininput.go | 8 + .../model_validatecustomdomainoutput.go | 10 + .../cdn/2024-02-01/endpoints/predicates.go | 55 + .../cdn/2024-02-01/endpoints/version.go | 10 + vendor/modules.txt | 1 + 128 files changed, 8907 insertions(+), 725 deletions(-) delete mode 100644 internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go create mode 100644 internal/services/cdn/frontdoordeliveryruleactiondiscriminator/delivery_rule_action_discriminator.go rename internal/services/cdn/{deliveryruleconditions => frontdoordeliveryruleconditiondiscriminator}/delivery_rule_condition_discriminator.go (72%) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/id_endpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/id_profile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_create.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_listbyprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_listresourceusage.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_loadcontent.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_purgecontent.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_start.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_stop.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_validatecustomdomain.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cacheconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cacheexpirationactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cachekeyquerystringactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_clientportmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cookiesmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedcustomdomain.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedcustomdomainproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigin.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigingroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigingroupproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedoriginproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrule.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecacheexpirationaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecachekeyquerystringaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleclientportcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecookiescondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulehostnamecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulehttpversioncondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleisdevicecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulepostargscondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulequerystringcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleremoteaddresscondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestbodycondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestheaderaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestheadercondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestmethodcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestschemecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequesturicondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleresponseheaderaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerouteconfigurationoverrideaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleserverportcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulesocketaddrcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulesslprotocolcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleurlfileextensioncondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleurlfilenamecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleurlpathcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparametersdeliverypolicy.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparameterswebapplicationfirewallpolicylink.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_geofilter.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_headeractionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_healthprobeparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_hostnamematchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_httperrorrangeparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_httpversionmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_isdevicematchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_keyvaultsigningkeyparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_loadparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverride.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverrideaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverrideactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_postargsmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_purgeparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_querystringmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_remoteaddressmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestbodymatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestheadermatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestmethodmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestschemematchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requesturimatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_resourcereference.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_resourceusage.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_responsebasedoriginerrordetectionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_routeconfigurationoverrideactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_serverportmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_socketaddrmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_sslprotocolmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlfileextensionmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlfilenamematchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlpathmatchconditionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlredirectaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlredirectactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlrewriteaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlrewriteactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningactionparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningkey.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningparamidentifier.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_validatecustomdomaininput.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_validatecustomdomainoutput.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/version.go diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource.go b/internal/services/cdn/cdn_frontdoor_rule_resource.go index ff865802b86d..50dcd4afa1e2 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource.go @@ -7,13 +7,13 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" "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/rules" "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + cdnFrontDoorConditionDiscriminator "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoordeliveryruleconditiondiscriminator" cdnFrontDoorRuleActions "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorruleactions" cdnFrontDoorRuleConditions "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorruleconditions" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" @@ -652,7 +652,7 @@ func resourceCdnFrontDoorRuleCreate(d *pluginsdk.ResourceData, meta interface{}) Actions: &actions, Conditions: &conditions, MatchProcessingBehavior: matchProcessingBehaviorValue, - RuleSetName: &ruleSet.RuleSetName, + RuleSetName: &ruleSetId.RuleSetName, Order: order, }, } @@ -761,7 +761,7 @@ func resourceCdnFrontDoorRuleUpdate(d *pluginsdk.ResourceData, meta interface{}) params.Properties.Conditions = &conditions } - err = client.UpdateThenPoll(ctx, id, params) + err = client.UpdateThenPoll(ctx, *id, params) if err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } @@ -779,7 +779,7 @@ func resourceCdnFrontDoorRuleDelete(d *pluginsdk.ResourceData, meta interface{}) return err } - err = client.DeleteThenPoll(ctx, id) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } @@ -788,12 +788,12 @@ func resourceCdnFrontDoorRuleDelete(d *pluginsdk.ResourceData, meta interface{}) } func expandFrontdoorDeliveryRuleActions(input []interface{}) ([]rules.DeliveryRuleAction, error) { - results := make([]cdn.BasicDeliveryRuleAction, 0) + results := make([]rules.DeliveryRuleAction, 0) if len(input) == 0 { return results, nil } - type expandfunc func(input []interface{}) (*[]cdn.BasicDeliveryRuleAction, error) + type expandfunc func(input []interface{}) (*[]rules.DeliveryRuleAction, error) m := *cdnFrontDoorRuleActions.InitializeCdnFrontDoorActionMappings() @@ -842,13 +842,13 @@ func expandFrontdoorDeliveryRuleActions(input []interface{}) ([]rules.DeliveryRu return results, nil } -func expandFrontdoorDeliveryRuleConditions(input []interface{}) ([]cdn.BasicDeliveryRuleCondition, error) { - results := make([]cdn.BasicDeliveryRuleCondition, 0) +func expandFrontdoorDeliveryRuleConditions(input []interface{}) ([]rules.DeliveryRuleCondition, error) { + results := make([]rules.DeliveryRuleCondition, 0) if len(input) == 0 || input[0] == nil { return results, nil } - type expandfunc func(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) + type expandfunc func(input []interface{}) (*[]rules.DeliveryRuleCondition, error) m := cdnFrontDoorRuleConditions.InitializeCdnFrontDoorConditionMappings() conditions := map[string]expandfunc{ @@ -873,10 +873,10 @@ func expandFrontdoorDeliveryRuleConditions(input []interface{}) ([]cdn.BasicDeli m.UrlPath.ConfigName: cdnFrontDoorRuleConditions.ExpandCdnFrontDoorUrlPathCondition, } - basicDeliveryRuleCondition := input[0].(map[string]interface{}) + deliveryRuleCondition := input[0].(map[string]interface{}) for conditionName, expand := range conditions { - raw := basicDeliveryRuleCondition[conditionName].([]interface{}) + raw := deliveryRuleCondition[conditionName].([]interface{}) if len(raw) > 0 { expanded, err := expand(raw) if err != nil { @@ -924,9 +924,16 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition urlFilenameCondition := make([]interface{}, 0) urlPathCondition := make([]interface{}, 0) - for _, BasicDeliveryRuleCondition := range *input { - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleClientPortCondition(); ok { - flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorClientPortCondition(condition) + // input here is the base wrapper object that has all of the data from the model... + for _, deliveryRuleCondition := range *input { + + if params, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleClientPortCondition(deliveryRuleCondition); ok { + + condition := rules.DeliveryRuleClientPortCondition{ + Name: rules.MatchVariableClientPort, + } + + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorClientPortCondition(deliveryRuleCondition) if err != nil { return nil, err } @@ -935,7 +942,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleCookiesCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleCookiesCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorCookiesCondition(condition) if err != nil { return nil, err @@ -945,7 +952,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleHostNameCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleHostNameCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorHostNameCondition(condition) if err != nil { return nil, err @@ -955,7 +962,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleHTTPVersionCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleHTTPVersionCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorHttpVersionCondition(condition) if err != nil { return nil, err @@ -964,7 +971,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleIsDeviceCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleIsDeviceCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorIsDeviceCondition(condition) if err != nil { return nil, err @@ -974,7 +981,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRulePostArgsCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRulePostArgsCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorPostArgsCondition(condition) if err != nil { return nil, err @@ -984,7 +991,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleQueryStringCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleQueryStringCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorQueryStringCondition(condition) if err != nil { return nil, err @@ -994,7 +1001,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleRemoteAddressCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRemoteAddressCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRemoteAddressCondition(condition) if err != nil { return nil, err @@ -1004,7 +1011,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleRequestBodyCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestBodyCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestBodyCondition(condition) if err != nil { return nil, err @@ -1014,7 +1021,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleRequestHeaderCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestHeaderCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestHeaderCondition(condition) if err != nil { return nil, err @@ -1024,7 +1031,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleRequestMethodCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestMethodCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestMethodCondition(condition) if err != nil { return nil, err @@ -1034,7 +1041,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleRequestSchemeCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestSchemeCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestSchemeCondition(condition) if err != nil { return nil, err @@ -1044,7 +1051,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleRequestURICondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestURICondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestUriCondition(condition) if err != nil { return nil, err @@ -1054,7 +1061,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleServerPortCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleServerPortCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorServerPortCondition(condition) if err != nil { return nil, err @@ -1064,7 +1071,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleSocketAddrCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleSocketAddrCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorSocketAddressCondition(condition) if err != nil { return nil, err @@ -1074,7 +1081,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleSslProtocolCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleSslProtocolCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorSslProtocolCondition(condition) if err != nil { return nil, err @@ -1084,7 +1091,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleURLFileExtensionCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleURLFileExtensionCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorUrlFileExtensionCondition(condition) if err != nil { return nil, err @@ -1094,7 +1101,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleURLFileNameCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleURLFileNameCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorUrlFileNameCondition(condition) if err != nil { return nil, err @@ -1104,7 +1111,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := BasicDeliveryRuleCondition.AsDeliveryRuleURLPathCondition(); ok { + if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleURLPathCondition(deliveryRuleCondition); ok { flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorUrlPathCondition(condition) if err != nil { return nil, err diff --git a/internal/services/cdn/deliveryruleconditions/cookies.go b/internal/services/cdn/deliveryruleconditions/cookies.go index 26a6c44934ae..508fda3b3c3b 100644 --- a/internal/services/cdn/deliveryruleconditions/cookies.go +++ b/internal/services/cdn/deliveryruleconditions/cookies.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -25,8 +24,17 @@ func Cookies() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForCookiesOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.OperatorAny), + string(cdn.OperatorBeginsWith), + string(cdn.OperatorContains), + string(cdn.OperatorEndsWith), + string(cdn.OperatorEqual), + string(cdn.OperatorGreaterThan), + string(cdn.OperatorGreaterThanOrEqual), + string(cdn.OperatorLessThan), + string(cdn.OperatorLessThanOrEqual), + }, false), }, "negate_condition": { @@ -51,8 +59,8 @@ func Cookies() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(rules.TransformLowercase), - string(rules.TransformUppercase), + string(cdn.TransformLowercase), + string(cdn.TransformUppercase), }, false), }, }, @@ -60,31 +68,37 @@ func Cookies() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionCookies(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionCookies(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - - cookiesCondition := rules.DeliveryRuleCookiesCondition{ - Name: rules.MatchVariableCookies, - Parameters: rules.CookiesMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleCookiesConditionParameters, - Selector: pointer.To(item["selector"].(string)), - Operator: rules.CookiesOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + cookiesCondition := cdn.DeliveryRuleCookiesCondition{ + Name: cdn.NameCookies, + Parameters: &cdn.CookiesMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleCookiesConditionParameters"), + Selector: utils.String(item["selector"].(string)), + Operator: cdn.CookiesOperator(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), - Transforms: expandTransforms(item["transforms"].([]interface{})), }, } + if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { + transforms := make([]cdn.Transform, 0) + for _, t := range rawTransforms { + transforms = append(transforms, cdn.Transform(t.(string))) + } + cookiesCondition.Parameters.Transforms = &transforms + } + output = append(output, cookiesCondition) } return output } -func FlattenArmCdnEndpointConditionCookies(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleCookiesCondition(input) +func FlattenArmCdnEndpointConditionCookies(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleCookiesCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule cookie condition") } @@ -95,13 +109,13 @@ func FlattenArmCdnEndpointConditionCookies(input rules.DeliveryRuleCondition) (* matchValues := make([]interface{}, 0) transforms := make([]string, 0) - if params := condition; params != nil { - operator = string(params.Operator) - + if params := condition.Parameters; params != nil { if params.Selector != nil { selector = *params.Selector } + operator = string(params.Operator) + if params.NegateCondition != nil { negateCondition = *params.NegateCondition } @@ -111,7 +125,9 @@ func FlattenArmCdnEndpointConditionCookies(input rules.DeliveryRuleCondition) (* } if params.Transforms != nil { - transforms = flattenTransforms(params.Transforms) + for _, transform := range *params.Transforms { + transforms = append(transforms, string(transform)) + } } } diff --git a/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go b/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go deleted file mode 100644 index e0dda9178fba..000000000000 --- a/internal/services/cdn/deliveryruleconditions/delivery_rule_conditions_helper.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package deliveryruleconditions - -import ( - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" -) - -func expandTransforms(input []interface{}) *[]rules.Transform { - if len(input) == 0 { - return nil - } - - result := make([]rules.Transform, 0) - - if v := input; len(v) != 0 { - for _, t := range v { - result = append(result, rules.Transform(t.(string))) - } - - return &result - } - - return nil -} - -func flattenTransforms(input *[]rules.Transform) []string { - result := make([]string, 0) - if input == nil { - return result - } - - for _, transform := range *input { - result = append(result, string(transform)) - } - - return result -} - -func expandIsDeviceMatchValue(input []interface{}) *[]rules.IsDeviceMatchValue { - result := make([]rules.IsDeviceMatchValue, 0) - - for _, item := range input { - if item != nil { - result = append(result, rules.IsDeviceMatchValue(item.(string))) - } - } - - return &result -} - -func flattenIsDeviceMatchValue(input *[]rules.IsDeviceMatchValue) []interface{} { - result := make([]interface{}, 0) - if input == nil { - return result - } - - for _, item := range *input { - result = append(result, string(item)) - } - - return result -} - -func expandRequestMethodMatchValue(input []interface{}) *[]rules.RequestMethodMatchValue { - result := make([]rules.RequestMethodMatchValue, 0) - - for _, item := range input { - if item != nil { - result = append(result, rules.RequestMethodMatchValue(item.(string))) - } - } - - return &result -} - -func flattenRequestMethodMatchValue(input *[]rules.RequestMethodMatchValue) []interface{} { - result := make([]interface{}, 0) - if input == nil { - return result - } - - for _, item := range *input { - result = append(result, string(item)) - } - - return result -} - -func expandRequestSchemeMatchValue(input []interface{}) *[]rules.RequestSchemeMatchValue { - result := make([]rules.RequestSchemeMatchValue, 0) - - for _, item := range input { - if item != nil { - result = append(result, rules.RequestSchemeMatchValue(item.(string))) - } - } - - return &result -} - -func flattenRequestSchemeMatchValue(input *[]rules.RequestSchemeMatchValue) []interface{} { - result := make([]interface{}, 0) - if input == nil { - return result - } - - for _, item := range *input { - result = append(result, string(item)) - } - - return result -} diff --git a/internal/services/cdn/deliveryruleconditions/device.go b/internal/services/cdn/deliveryruleconditions/device.go index 7ddca6eb2923..aa4ad409f5eb 100644 --- a/internal/services/cdn/deliveryruleconditions/device.go +++ b/internal/services/cdn/deliveryruleconditions/device.go @@ -6,10 +6,10 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" ) func Device() *pluginsdk.Resource { @@ -18,9 +18,10 @@ func Device() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Optional: true, - Default: string(rules.IsDeviceOperatorEqual), - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForIsDeviceOperator(), - false), + Default: "Equal", + ValidateFunc: validation.StringInSlice([]string{ + "Equal", + }, false), }, "negate_condition": { @@ -35,27 +36,28 @@ func Device() *pluginsdk.Resource { MinItems: 1, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForIsDeviceMatchValue(), - false), + ValidateFunc: validation.StringInSlice([]string{ + "Desktop", + "Mobile", + }, false), }, }, }, } } -func ExpandArmCdnEndpointConditionDevice(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionDevice(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - - output = append(output, rules.DeliveryRuleIsDeviceCondition{ - Name: rules.MatchVariableIsDevice, - Parameters: rules.IsDeviceMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters, - Operator: rules.IsDeviceOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), - MatchValues: expandIsDeviceMatchValue(item["match_values"].(*pluginsdk.Set).List()), + output = append(output, cdn.DeliveryRuleIsDeviceCondition{ + Name: cdn.NameHTTPVersion, + Parameters: &cdn.IsDeviceMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleIsDeviceConditionParameters"), + Operator: utils.String(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), + MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, }) } @@ -63,8 +65,8 @@ func ExpandArmCdnEndpointConditionDevice(input []interface{}) []rules.DeliveryRu return output } -func FlattenArmCdnEndpointConditionDevice(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleIsDeviceCondition(input) +func FlattenArmCdnEndpointConditionDevice(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleIsDeviceCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule device condition") } @@ -72,16 +74,17 @@ func FlattenArmCdnEndpointConditionDevice(input rules.DeliveryRuleCondition) (*m operator := "" matchValues := make([]interface{}, 0) negateCondition := false - - if params := condition; params != nil { - operator = string(params.Operator) + if params := condition.Parameters; params != nil { + if params.Operator != nil { + operator = *params.Operator + } if params.NegateCondition != nil { negateCondition = *params.NegateCondition } if params.MatchValues != nil { - matchValues = flattenIsDeviceMatchValue(params.MatchValues) + matchValues = utils.FlattenStringSlice(params.MatchValues) } } diff --git a/internal/services/cdn/deliveryruleconditions/http_version.go b/internal/services/cdn/deliveryruleconditions/http_version.go index e3bf444e62ad..a776ec413361 100644 --- a/internal/services/cdn/deliveryruleconditions/http_version.go +++ b/internal/services/cdn/deliveryruleconditions/http_version.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -19,9 +18,10 @@ func HTTPVersion() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Optional: true, - Default: string(rules.HTTPVersionOperatorEqual), - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForHTTPVersionOperator(), - false), + Default: "Equal", + ValidateFunc: validation.StringInSlice([]string{ + "Equal", + }, false), }, "negate_condition": { @@ -48,18 +48,17 @@ func HTTPVersion() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionHTTPVersion(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionHTTPVersion(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - - output = append(output, rules.DeliveryRuleHTTPVersionCondition{ - Name: rules.MatchVariableHTTPVersion, - Parameters: rules.HTTPVersionMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleHTTPVersionConditionParameters, - Operator: rules.HTTPVersionOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + output = append(output, cdn.DeliveryRuleHTTPVersionCondition{ + Name: cdn.NameHTTPVersion, + Parameters: &cdn.HTTPVersionMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleHttpVersionConditionParameters"), + Operator: utils.String(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, }) @@ -68,8 +67,8 @@ func ExpandArmCdnEndpointConditionHTTPVersion(input []interface{}) []rules.Deliv return output } -func FlattenArmCdnEndpointConditionHTTPVersion(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleHTTPVersionCondition(input) +func FlattenArmCdnEndpointConditionHTTPVersion(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleHTTPVersionCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule http version condition") } @@ -77,9 +76,10 @@ func FlattenArmCdnEndpointConditionHTTPVersion(input rules.DeliveryRuleCondition operator := "" matchValues := make([]interface{}, 0) negateCondition := false - - if params := condition; params != nil { - operator = string(params.Operator) + if params := condition.Parameters; params != nil { + if params.Operator != nil { + operator = *params.Operator + } if params.NegateCondition != nil { negateCondition = *params.NegateCondition diff --git a/internal/services/cdn/deliveryruleconditions/post_arg.go b/internal/services/cdn/deliveryruleconditions/post_arg.go index fc91c1195fe5..a5754bb1fb24 100644 --- a/internal/services/cdn/deliveryruleconditions/post_arg.go +++ b/internal/services/cdn/deliveryruleconditions/post_arg.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -25,8 +24,17 @@ func PostArg() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForPostArgsOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.PostArgsOperatorAny), + string(cdn.PostArgsOperatorBeginsWith), + string(cdn.PostArgsOperatorContains), + string(cdn.PostArgsOperatorEndsWith), + string(cdn.PostArgsOperatorEqual), + string(cdn.PostArgsOperatorGreaterThan), + string(cdn.PostArgsOperatorGreaterThanOrEqual), + string(cdn.PostArgsOperatorLessThan), + string(cdn.PostArgsOperatorLessThanOrEqual), + }, false), }, "negate_condition": { @@ -51,8 +59,8 @@ func PostArg() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(rules.TransformLowercase), - string(rules.TransformUppercase), + string(cdn.TransformLowercase), + string(cdn.TransformUppercase), }, false), }, }, @@ -60,32 +68,39 @@ func PostArg() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionPostArg(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionPostArg(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - condition := rules.DeliveryRulePostArgsCondition{ - Name: rules.MatchVariablePostArgs, - Parameters: rules.PostArgsMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRulePostArgsConditionParameters, - Selector: pointer.To(item["selector"].(string)), - Operator: rules.PostArgsOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + condition := cdn.DeliveryRulePostArgsCondition{ + Name: cdn.NameCookies, + Parameters: &cdn.PostArgsMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRulePostArgsConditionParameters"), + Selector: utils.String(item["selector"].(string)), + Operator: cdn.PostArgsOperator(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), - Transforms: expandTransforms(item["transforms"].([]interface{})), }, } + if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { + transforms := make([]cdn.Transform, 0) + for _, t := range rawTransforms { + transforms = append(transforms, cdn.Transform(t.(string))) + } + condition.Parameters.Transforms = &transforms + } + output = append(output, condition) } return output } -func FlattenArmCdnEndpointConditionPostArg(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRulePostArgsCondition(input) +func FlattenArmCdnEndpointConditionPostArg(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRulePostArgsCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule post args condition") } @@ -96,7 +111,7 @@ func FlattenArmCdnEndpointConditionPostArg(input rules.DeliveryRuleCondition) (* selector := "" transforms := make([]string, 0) - if params := condition; params != nil { + if params := condition.Parameters; params != nil { if params.Selector != nil { selector = *params.Selector } @@ -112,7 +127,9 @@ func FlattenArmCdnEndpointConditionPostArg(input rules.DeliveryRuleCondition) (* } if params.Transforms != nil { - transforms = flattenTransforms(params.Transforms) + for _, transform := range *params.Transforms { + transforms = append(transforms, string(transform)) + } } } diff --git a/internal/services/cdn/deliveryruleconditions/query_string.go b/internal/services/cdn/deliveryruleconditions/query_string.go index 24c0c7f2052b..5fca2a857154 100644 --- a/internal/services/cdn/deliveryruleconditions/query_string.go +++ b/internal/services/cdn/deliveryruleconditions/query_string.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -19,8 +18,17 @@ func QueryString() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForQueryStringOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.QueryStringOperatorAny), + string(cdn.QueryStringOperatorBeginsWith), + string(cdn.QueryStringOperatorContains), + string(cdn.QueryStringOperatorEndsWith), + string(cdn.QueryStringOperatorEqual), + string(cdn.QueryStringOperatorGreaterThan), + string(cdn.QueryStringOperatorGreaterThanOrEqual), + string(cdn.QueryStringOperatorLessThan), + string(cdn.QueryStringOperatorLessThanOrEqual), + }, false), }, "negate_condition": { @@ -45,8 +53,8 @@ func QueryString() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(rules.TransformLowercase), - string(rules.TransformUppercase), + string(cdn.TransformLowercase), + string(cdn.TransformUppercase), }, false), }, }, @@ -54,31 +62,38 @@ func QueryString() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionQueryString(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionQueryString(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - queryStringCondition := rules.DeliveryRuleQueryStringCondition{ - Name: rules.MatchVariableQueryString, - Parameters: rules.QueryStringMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleQueryStringConditionParameters, - Operator: rules.QueryStringOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + queryStringCondition := cdn.DeliveryRuleQueryStringCondition{ + Name: cdn.NameQueryString, + Parameters: &cdn.QueryStringMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleQueryStringConditionParameters"), + Operator: cdn.QueryStringOperator(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), - Transforms: expandTransforms(item["transforms"].([]interface{})), }, } + if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { + transforms := make([]cdn.Transform, 0) + for _, t := range rawTransforms { + transforms = append(transforms, cdn.Transform(t.(string))) + } + queryStringCondition.Parameters.Transforms = &transforms + } + output = append(output, queryStringCondition) } return output } -func FlattenArmCdnEndpointConditionQueryString(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleQueryStringCondition(input) +func FlattenArmCdnEndpointConditionQueryString(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleQueryStringCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule query string condition") } @@ -87,8 +102,7 @@ func FlattenArmCdnEndpointConditionQueryString(input rules.DeliveryRuleCondition matchValues := make([]interface{}, 0) negateCondition := false transforms := make([]string, 0) - - if params := condition; params != nil { + if params := condition.Parameters; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -100,7 +114,9 @@ func FlattenArmCdnEndpointConditionQueryString(input rules.DeliveryRuleCondition } if params.Transforms != nil { - transforms = flattenTransforms(params.Transforms) + for _, transform := range *params.Transforms { + transforms = append(transforms, string(transform)) + } } } diff --git a/internal/services/cdn/deliveryruleconditions/remote_address.go b/internal/services/cdn/deliveryruleconditions/remote_address.go index 263afee71a1b..73b037efb743 100644 --- a/internal/services/cdn/deliveryruleconditions/remote_address.go +++ b/internal/services/cdn/deliveryruleconditions/remote_address.go @@ -6,7 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -18,8 +18,11 @@ func RemoteAddress() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRemoteAddressOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.RemoteAddressOperatorAny), + string(cdn.RemoteAddressOperatorGeoMatch), + string(cdn.RemoteAddressOperatorIPMatch), + }, false), }, "negate_condition": { @@ -41,17 +44,17 @@ func RemoteAddress() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionRemoteAddress(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRemoteAddress(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - output = append(output, rules.DeliveryRuleRemoteAddressCondition{ - Name: rules.MatchVariableRemoteAddress, - Parameters: rules.RemoteAddressMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRemoteAddressConditionParameters, - Operator: rules.RemoteAddressOperator(item["operator"].(string)), + output = append(output, cdn.DeliveryRuleRemoteAddressCondition{ + Name: cdn.NameRemoteAddress, + Parameters: &cdn.RemoteAddressMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRemoteAddressConditionParameters"), + Operator: cdn.RemoteAddressOperator(item["operator"].(string)), NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, @@ -61,8 +64,8 @@ func ExpandArmCdnEndpointConditionRemoteAddress(input []interface{}) []rules.Del return output } -func FlattenArmCdnEndpointConditionRemoteAddress(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleRemoteAddressCondition(input) +func FlattenArmCdnEndpointConditionRemoteAddress(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleRemoteAddressCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule address condition") } @@ -70,8 +73,7 @@ func FlattenArmCdnEndpointConditionRemoteAddress(input rules.DeliveryRuleConditi operator := "" negateCondition := false matchValues := make([]interface{}, 0) - - if params := condition; params != nil { + if params := condition.Parameters; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { diff --git a/internal/services/cdn/deliveryruleconditions/request_body.go b/internal/services/cdn/deliveryruleconditions/request_body.go index dd487ad1a90d..3ab69b6be9c5 100644 --- a/internal/services/cdn/deliveryruleconditions/request_body.go +++ b/internal/services/cdn/deliveryruleconditions/request_body.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -19,8 +18,17 @@ func RequestBody() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestBodyOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.RequestBodyOperatorAny), + string(cdn.RequestBodyOperatorBeginsWith), + string(cdn.RequestBodyOperatorContains), + string(cdn.RequestBodyOperatorEndsWith), + string(cdn.RequestBodyOperatorEqual), + string(cdn.RequestBodyOperatorGreaterThan), + string(cdn.RequestBodyOperatorGreaterThanOrEqual), + string(cdn.RequestBodyOperatorLessThan), + string(cdn.RequestBodyOperatorLessThanOrEqual), + }, false), }, "negate_condition": { @@ -45,8 +53,8 @@ func RequestBody() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(rules.TransformLowercase), - string(rules.TransformUppercase), + string(cdn.TransformLowercase), + string(cdn.TransformUppercase), }, false), }, }, @@ -54,31 +62,38 @@ func RequestBody() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionRequestBody(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestBody(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestBodyCondition := rules.DeliveryRuleRequestBodyCondition{ - Name: rules.MatchVariableRequestBody, - Parameters: rules.RequestBodyMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestBodyConditionParameters, - Operator: rules.RequestBodyOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + queryStringCondition := cdn.DeliveryRuleRequestBodyCondition{ + Name: cdn.NameRequestBody, + Parameters: &cdn.RequestBodyMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestBodyConditionParameters"), + Operator: cdn.RequestBodyOperator(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), - Transforms: expandTransforms(item["transforms"].([]interface{})), }, } - output = append(output, requestBodyCondition) + if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { + transforms := make([]cdn.Transform, 0) + for _, t := range rawTransforms { + transforms = append(transforms, cdn.Transform(t.(string))) + } + queryStringCondition.Parameters.Transforms = &transforms + } + + output = append(output, queryStringCondition) } return output } -func FlattenArmCdnEndpointConditionRequestBody(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleRequestBodyCondition(input) +func FlattenArmCdnEndpointConditionRequestBody(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleRequestBodyCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule request body condition") } @@ -87,8 +102,7 @@ func FlattenArmCdnEndpointConditionRequestBody(input rules.DeliveryRuleCondition matchValues := make([]interface{}, 0) negateCondition := false transforms := make([]string, 0) - - if params := condition; params != nil { + if params := condition.Parameters; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -100,7 +114,9 @@ func FlattenArmCdnEndpointConditionRequestBody(input rules.DeliveryRuleCondition } if params.Transforms != nil { - transforms = flattenTransforms(params.Transforms) + for _, transform := range *params.Transforms { + transforms = append(transforms, string(transform)) + } } } diff --git a/internal/services/cdn/deliveryruleconditions/request_header.go b/internal/services/cdn/deliveryruleconditions/request_header.go index c89c7ac11add..47aa0c2cee45 100644 --- a/internal/services/cdn/deliveryruleconditions/request_header.go +++ b/internal/services/cdn/deliveryruleconditions/request_header.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -25,8 +24,17 @@ func RequestHeader() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestHeaderOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.RequestHeaderOperatorAny), + string(cdn.RequestHeaderOperatorBeginsWith), + string(cdn.RequestHeaderOperatorContains), + string(cdn.RequestHeaderOperatorEndsWith), + string(cdn.RequestHeaderOperatorEqual), + string(cdn.RequestHeaderOperatorGreaterThan), + string(cdn.RequestHeaderOperatorGreaterThanOrEqual), + string(cdn.RequestHeaderOperatorLessThan), + string(cdn.RequestHeaderOperatorLessThanOrEqual), + }, false), }, "negate_condition": { @@ -51,8 +59,8 @@ func RequestHeader() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(rules.TransformLowercase), - string(rules.TransformUppercase), + string(cdn.TransformLowercase), + string(cdn.TransformUppercase), }, false), }, }, @@ -60,32 +68,38 @@ func RequestHeader() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionRequestHeader(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestHeader(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - - requestHeaderCondition := rules.DeliveryRuleRequestHeaderCondition{ - Name: rules.MatchVariableRequestHeader, - Parameters: rules.RequestHeaderMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestHeaderConditionParameters, - Selector: pointer.To(item["selector"].(string)), - Operator: rules.RequestHeaderOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + requestHeaderCondition := cdn.DeliveryRuleRequestHeaderCondition{ + Name: cdn.NameRequestHeader, + Parameters: &cdn.RequestHeaderMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestHeaderConditionParameters"), + Selector: utils.String(item["selector"].(string)), + Operator: cdn.RequestHeaderOperator(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), - Transforms: expandTransforms(item["transforms"].([]interface{})), }, } + if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { + transforms := make([]cdn.Transform, 0) + for _, t := range rawTransforms { + transforms = append(transforms, cdn.Transform(t.(string))) + } + requestHeaderCondition.Parameters.Transforms = &transforms + } + output = append(output, requestHeaderCondition) } return output } -func FlattenArmCdnEndpointConditionRequestHeader(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleRequestHeaderCondition(input) +func FlattenArmCdnEndpointConditionRequestHeader(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleRequestHeaderCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule request header condition") } @@ -95,8 +109,7 @@ func FlattenArmCdnEndpointConditionRequestHeader(input rules.DeliveryRuleConditi matchValues := make([]interface{}, 0) negateCondition := false transforms := make([]string, 0) - - if params := condition; params != nil { + if params := condition.Parameters; params != nil { if params.Selector != nil { selector = *params.Selector } @@ -112,7 +125,9 @@ func FlattenArmCdnEndpointConditionRequestHeader(input rules.DeliveryRuleConditi } if params.Transforms != nil { - transforms = flattenTransforms(params.Transforms) + for _, transform := range *params.Transforms { + transforms = append(transforms, string(transform)) + } } } diff --git a/internal/services/cdn/deliveryruleconditions/request_method.go b/internal/services/cdn/deliveryruleconditions/request_method.go index 0885c6261788..5a7b3e3a0c8c 100644 --- a/internal/services/cdn/deliveryruleconditions/request_method.go +++ b/internal/services/cdn/deliveryruleconditions/request_method.go @@ -6,10 +6,10 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" ) func RequestMethod() *pluginsdk.Resource { @@ -19,8 +19,9 @@ func RequestMethod() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Default: "Equal", - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestMethodOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + "Equal", + }, false), }, "negate_condition": { @@ -35,27 +36,32 @@ func RequestMethod() *pluginsdk.Resource { MinItems: 1, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestMethodMatchValue(), - false), + ValidateFunc: validation.StringInSlice([]string{ + "DELETE", + "GET", + "HEAD", + "OPTIONS", + "POST", + "PUT", + }, false), }, }, }, } } -func ExpandArmCdnEndpointConditionRequestMethod(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestMethod(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - - output = append(output, rules.DeliveryRuleRequestMethodCondition{ - Name: rules.MatchVariableRequestMethod, - Parameters: rules.RequestMethodMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters, - Operator: rules.RequestMethodOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), - MatchValues: expandRequestMethodMatchValue(item["match_values"].(*pluginsdk.Set).List()), + output = append(output, cdn.DeliveryRuleRequestMethodCondition{ + Name: cdn.NameRequestMethod, + Parameters: &cdn.RequestMethodMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestMethodConditionParameters"), + Operator: utils.String(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), + MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, }) } @@ -63,8 +69,8 @@ func ExpandArmCdnEndpointConditionRequestMethod(input []interface{}) []rules.Del return output } -func FlattenArmCdnEndpointConditionRequestMethod(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleRequestMethodCondition(input) +func FlattenArmCdnEndpointConditionRequestMethod(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleRequestMethodCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule request method condition") } @@ -72,16 +78,17 @@ func FlattenArmCdnEndpointConditionRequestMethod(input rules.DeliveryRuleConditi operator := "" negateCondition := false matchValues := make([]interface{}, 0) - - if params := condition; params != nil { - operator = string(params.Operator) + if params := condition.Parameters; params != nil { + if params.Operator != nil { + operator = *params.Operator + } if params.NegateCondition != nil { negateCondition = *params.NegateCondition } if params.MatchValues != nil { - matchValues = flattenRequestMethodMatchValue(params.MatchValues) + matchValues = utils.FlattenStringSlice(params.MatchValues) } } diff --git a/internal/services/cdn/deliveryruleconditions/request_scheme.go b/internal/services/cdn/deliveryruleconditions/request_scheme.go index 2a2a68a1e4b6..345435dfdf24 100644 --- a/internal/services/cdn/deliveryruleconditions/request_scheme.go +++ b/internal/services/cdn/deliveryruleconditions/request_scheme.go @@ -6,10 +6,10 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" ) func RequestScheme() *pluginsdk.Resource { @@ -18,9 +18,9 @@ func RequestScheme() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Optional: true, - Default: string(rules.OperatorEqual), + Default: "Equal", ValidateFunc: validation.StringInSlice([]string{ - string(rules.OperatorEqual), + "Equal", }, false), }, @@ -36,38 +36,43 @@ func RequestScheme() *pluginsdk.Resource { MinItems: 1, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestSchemeMatchValue(), - false), + ValidateFunc: validation.StringInSlice([]string{ + "HTTP", + "HTTPS", + }, false), }, }, }, } } -func ExpandArmCdnEndpointConditionRequestScheme(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestScheme(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestSchemeCondition := rules.DeliveryRuleRequestSchemeCondition{ - Name: rules.MatchVariableRequestScheme, - Parameters: rules.RequestSchemeMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestSchemeConditionParameters, - Operator: rules.Operator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), - MatchValues: expandRequestSchemeMatchValue(item["match_values"].(*pluginsdk.Set).List()), + requestSchemeCondition := cdn.DeliveryRuleRequestSchemeCondition{ + Name: cdn.NameRequestScheme, + Parameters: &cdn.RequestSchemeMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestSchemeConditionParameters"), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), + MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, } + if operator := item["operator"]; operator.(string) != "" { + requestSchemeCondition.Parameters.Operator = utils.String(operator.(string)) + } + output = append(output, requestSchemeCondition) } return output } -func FlattenArmCdnEndpointConditionRequestScheme(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleRequestSchemeCondition(input) +func FlattenArmCdnEndpointConditionRequestScheme(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleRequestSchemeCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule request scheme condition") } @@ -75,15 +80,17 @@ func FlattenArmCdnEndpointConditionRequestScheme(input rules.DeliveryRuleConditi operator := "" negateCondition := false matchValues := make([]interface{}, 0) - if params := condition; params != nil { - operator = string(params.Operator) + if params := condition.Parameters; params != nil { + if params.Operator != nil { + operator = *params.Operator + } if params.NegateCondition != nil { negateCondition = *params.NegateCondition } if params.MatchValues != nil { - matchValues = flattenRequestSchemeMatchValue(params.MatchValues) + matchValues = utils.FlattenStringSlice(params.MatchValues) } } diff --git a/internal/services/cdn/deliveryruleconditions/request_uri.go b/internal/services/cdn/deliveryruleconditions/request_uri.go index 5c7d530f5d0c..afd19b239530 100644 --- a/internal/services/cdn/deliveryruleconditions/request_uri.go +++ b/internal/services/cdn/deliveryruleconditions/request_uri.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -19,8 +18,17 @@ func RequestURI() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForRequestUriOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.RequestURIOperatorAny), + string(cdn.RequestURIOperatorBeginsWith), + string(cdn.RequestURIOperatorContains), + string(cdn.RequestURIOperatorEndsWith), + string(cdn.RequestURIOperatorEqual), + string(cdn.RequestURIOperatorGreaterThan), + string(cdn.RequestURIOperatorGreaterThanOrEqual), + string(cdn.RequestURIOperatorLessThan), + string(cdn.RequestURIOperatorLessThanOrEqual), + }, false), }, "negate_condition": { @@ -45,8 +53,8 @@ func RequestURI() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(rules.TransformLowercase), - string(rules.TransformUppercase), + string(cdn.TransformLowercase), + string(cdn.TransformUppercase), }, false), }, }, @@ -54,30 +62,37 @@ func RequestURI() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionRequestURI(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionRequestURI(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestURICondition := rules.DeliveryRuleRequestUriCondition{ - Name: rules.MatchVariableRequestUri, - Parameters: rules.RequestUriMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestUriConditionParameters, - Operator: rules.RequestUriOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + requestURICondition := cdn.DeliveryRuleRequestURICondition{ + Name: cdn.NameRequestURI, + Parameters: &cdn.RequestURIMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleRequestUriConditionParameters"), + Operator: cdn.RequestURIOperator(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), - Transforms: expandTransforms(item["transforms"].([]interface{})), }, } + if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { + transforms := make([]cdn.Transform, 0) + for _, t := range rawTransforms { + transforms = append(transforms, cdn.Transform(t.(string))) + } + requestURICondition.Parameters.Transforms = &transforms + } + output = append(output, requestURICondition) } return output } -func FlattenArmCdnEndpointConditionRequestURI(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleRequestUriCondition(input) +func FlattenArmCdnEndpointConditionRequestURI(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleRequestURICondition() if !ok { return nil, fmt.Errorf("expected a delivery rule request uri condition") } @@ -86,7 +101,7 @@ func FlattenArmCdnEndpointConditionRequestURI(input rules.DeliveryRuleCondition) negateCondition := false operator := "" transforms := make([]string, 0) - if params := condition; params != nil { + if params := condition.Parameters; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -98,7 +113,9 @@ func FlattenArmCdnEndpointConditionRequestURI(input rules.DeliveryRuleCondition) } if params.Transforms != nil { - transforms = flattenTransforms(params.Transforms) + for _, transform := range *params.Transforms { + transforms = append(transforms, string(transform)) + } } } diff --git a/internal/services/cdn/deliveryruleconditions/url_file_extension.go b/internal/services/cdn/deliveryruleconditions/url_file_extension.go index 9765800cb183..73516981ba3b 100644 --- a/internal/services/cdn/deliveryruleconditions/url_file_extension.go +++ b/internal/services/cdn/deliveryruleconditions/url_file_extension.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -19,8 +18,17 @@ func URLFileExtension() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForURLFileExtensionOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.URLFileExtensionOperatorAny), + string(cdn.URLFileExtensionOperatorBeginsWith), + string(cdn.URLFileExtensionOperatorContains), + string(cdn.URLFileExtensionOperatorEndsWith), + string(cdn.URLFileExtensionOperatorEqual), + string(cdn.URLFileExtensionOperatorGreaterThan), + string(cdn.URLFileExtensionOperatorGreaterThanOrEqual), + string(cdn.URLFileExtensionOperatorLessThan), + string(cdn.URLFileExtensionOperatorLessThanOrEqual), + }, false), }, "negate_condition": { @@ -45,8 +53,8 @@ func URLFileExtension() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(rules.TransformLowercase), - string(rules.TransformUppercase), + string(cdn.TransformLowercase), + string(cdn.TransformUppercase), }, false), }, }, @@ -54,31 +62,38 @@ func URLFileExtension() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionURLFileExtension(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionURLFileExtension(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestURICondition := rules.DeliveryRuleURLFileExtensionCondition{ - Name: rules.MatchVariableURLFileExtension, - Parameters: rules.URLFileExtensionMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters, - Operator: rules.URLFileExtensionOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + requestURICondition := cdn.DeliveryRuleURLFileExtensionCondition{ + Name: cdn.NameURLFileExtension, + Parameters: &cdn.URLFileExtensionMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFileExtensionMatchConditionParameters"), + Operator: cdn.URLFileExtensionOperator(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), - Transforms: expandTransforms(item["transforms"].([]interface{})), }, } + if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { + transforms := make([]cdn.Transform, 0) + for _, t := range rawTransforms { + transforms = append(transforms, cdn.Transform(t.(string))) + } + requestURICondition.Parameters.Transforms = &transforms + } + output = append(output, requestURICondition) } return output } -func FlattenArmCdnEndpointConditionURLFileExtension(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleURLFileExtensionCondition(input) +func FlattenArmCdnEndpointConditionURLFileExtension(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleURLFileExtensionCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule url file extension condition") } @@ -87,8 +102,7 @@ func FlattenArmCdnEndpointConditionURLFileExtension(input rules.DeliveryRuleCond negateCondition := false operator := "" transforms := make([]string, 0) - - if params := condition; params != nil { + if params := condition.Parameters; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -100,7 +114,9 @@ func FlattenArmCdnEndpointConditionURLFileExtension(input rules.DeliveryRuleCond } if params.Transforms != nil { - transforms = flattenTransforms(params.Transforms) + for _, transform := range *params.Transforms { + transforms = append(transforms, string(transform)) + } } } diff --git a/internal/services/cdn/deliveryruleconditions/url_file_name.go b/internal/services/cdn/deliveryruleconditions/url_file_name.go index 12791165c596..20a87e1a53a6 100644 --- a/internal/services/cdn/deliveryruleconditions/url_file_name.go +++ b/internal/services/cdn/deliveryruleconditions/url_file_name.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -19,8 +18,17 @@ func URLFileName() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForURLFileNameOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.URLFileNameOperatorAny), + string(cdn.URLFileNameOperatorBeginsWith), + string(cdn.URLFileNameOperatorContains), + string(cdn.URLFileNameOperatorEndsWith), + string(cdn.URLFileNameOperatorEqual), + string(cdn.URLFileNameOperatorGreaterThan), + string(cdn.URLFileNameOperatorGreaterThanOrEqual), + string(cdn.URLFileNameOperatorLessThan), + string(cdn.URLFileNameOperatorLessThanOrEqual), + }, false), }, "negate_condition": { @@ -45,8 +53,8 @@ func URLFileName() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(rules.TransformLowercase), - string(rules.TransformUppercase), + string(cdn.TransformLowercase), + string(cdn.TransformUppercase), }, false), }, }, @@ -54,31 +62,38 @@ func URLFileName() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionURLFileName(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionURLFileName(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestURICondition := rules.DeliveryRuleURLFileNameCondition{ - Name: rules.MatchVariableURLFileName, - Parameters: rules.URLFileNameMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters, - Operator: rules.URLFileNameOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + requestURICondition := cdn.DeliveryRuleURLFileNameCondition{ + Name: cdn.NameURLFileName, + Parameters: &cdn.URLFileNameMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFilenameConditionParameters"), + Operator: cdn.URLFileNameOperator(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), - Transforms: expandTransforms(item["transforms"].([]interface{})), }, } + if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { + transforms := make([]cdn.Transform, 0) + for _, t := range rawTransforms { + transforms = append(transforms, cdn.Transform(t.(string))) + } + requestURICondition.Parameters.Transforms = &transforms + } + output = append(output, requestURICondition) } return output } -func FlattenArmCdnEndpointConditionURLFileName(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleURLFileNameCondition(input) +func FlattenArmCdnEndpointConditionURLFileName(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleURLFileNameCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule url file name condition") } @@ -87,7 +102,7 @@ func FlattenArmCdnEndpointConditionURLFileName(input rules.DeliveryRuleCondition negateCondition := false operator := "" transforms := make([]string, 0) - if params := condition; params != nil { + if params := condition.Parameters; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { diff --git a/internal/services/cdn/deliveryruleconditions/url_path.go b/internal/services/cdn/deliveryruleconditions/url_path.go index 731b972c2e3a..f9f8413e6c6e 100644 --- a/internal/services/cdn/deliveryruleconditions/url_path.go +++ b/internal/services/cdn/deliveryruleconditions/url_path.go @@ -6,8 +6,7 @@ package deliveryruleconditions import ( "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -19,8 +18,19 @@ func URLPath() *pluginsdk.Resource { "operator": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(rules.PossibleValuesForURLPathOperator(), - false), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.URLPathOperatorAny), + string(cdn.URLPathOperatorBeginsWith), + string(cdn.URLPathOperatorContains), + string(cdn.URLPathOperatorEndsWith), + string(cdn.URLPathOperatorEqual), + string(cdn.URLPathOperatorGreaterThan), + string(cdn.URLPathOperatorGreaterThanOrEqual), + string(cdn.URLPathOperatorLessThan), + string(cdn.URLPathOperatorLessThanOrEqual), + string(cdn.URLPathOperatorRegEx), + string(cdn.URLPathOperatorWildcard), + }, false), }, "negate_condition": { @@ -45,8 +55,8 @@ func URLPath() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(rules.TransformLowercase), - string(rules.TransformUppercase), + string(cdn.TransformLowercase), + string(cdn.TransformUppercase), }, false), }, }, @@ -54,26 +64,26 @@ func URLPath() *pluginsdk.Resource { } } -func ExpandArmCdnEndpointConditionURLPath(input []interface{}) []rules.DeliveryRuleCondition { - output := make([]rules.DeliveryRuleCondition, 0) +func ExpandArmCdnEndpointConditionURLPath(input []interface{}) []cdn.BasicDeliveryRuleCondition { + output := make([]cdn.BasicDeliveryRuleCondition, 0) for _, v := range input { item := v.(map[string]interface{}) - requestURICondition := rules.DeliveryRuleURLPathCondition{ - Name: rules.MatchVariableURLPath, - Parameters: rules.URLPathMatchConditionParameters{ - TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleURLPathMatchConditionParameters, - Operator: rules.URLPathOperator(item["operator"].(string)), - NegateCondition: pointer.To(item["negate_condition"].(bool)), + requestURICondition := cdn.DeliveryRuleURLPathCondition{ + Name: cdn.NameURLPath, + Parameters: &cdn.URLPathMatchConditionParameters{ + OdataType: utils.String("Microsoft.Azure.Cdn.Models.DeliveryRuleUrlPathMatchConditionParameters"), + Operator: cdn.URLPathOperator(item["operator"].(string)), + NegateCondition: utils.Bool(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].(*pluginsdk.Set).List()), }, } if rawTransforms := item["transforms"].([]interface{}); len(rawTransforms) != 0 { - transforms := make([]rules.Transform, 0) + transforms := make([]cdn.Transform, 0) for _, t := range rawTransforms { - transforms = append(transforms, rules.Transform(t.(string))) + transforms = append(transforms, cdn.Transform(t.(string))) } requestURICondition.Parameters.Transforms = &transforms } @@ -84,8 +94,8 @@ func ExpandArmCdnEndpointConditionURLPath(input []interface{}) []rules.DeliveryR return output } -func FlattenArmCdnEndpointConditionURLPath(input rules.DeliveryRuleCondition) (*map[string]interface{}, error) { - condition, ok := AsDeliveryRuleURLPathCondition(input) +func FlattenArmCdnEndpointConditionURLPath(input cdn.BasicDeliveryRuleCondition) (*map[string]interface{}, error) { + condition, ok := input.AsDeliveryRuleURLPathCondition() if !ok { return nil, fmt.Errorf("expected a delivery rule url path condition") } @@ -94,7 +104,7 @@ func FlattenArmCdnEndpointConditionURLPath(input rules.DeliveryRuleCondition) (* negateCondition := false operator := "" transforms := make([]string, 0) - if params := condition; params != nil { + if params := condition.Parameters; params != nil { operator = string(params.Operator) if params.NegateCondition != nil { @@ -106,7 +116,9 @@ func FlattenArmCdnEndpointConditionURLPath(input rules.DeliveryRuleCondition) (* } if params.Transforms != nil { - flattenTransforms(params.Transforms) + for _, transform := range *params.Transforms { + transforms = append(transforms, string(transform)) + } } } diff --git a/internal/services/cdn/frontdoordeliveryruleactiondiscriminator/delivery_rule_action_discriminator.go b/internal/services/cdn/frontdoordeliveryruleactiondiscriminator/delivery_rule_action_discriminator.go new file mode 100644 index 000000000000..65cfaa786064 --- /dev/null +++ b/internal/services/cdn/frontdoordeliveryruleactiondiscriminator/delivery_rule_action_discriminator.go @@ -0,0 +1,63 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package frontdoordeliveryruleactiondiscriminator + +import ( + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" +) + +func AsDeliveryRuleCacheExpirationAction(input rules.DeliveryRuleAction) (*rules.DeliveryRuleCacheExpirationAction, bool) { + if input.DeliveryRuleAction().Name != rules.DeliveryRuleActionNameRouteConfigurationOverride { + return nil, false + } + + cacheExpiration := rules.DeliveryRuleCacheExpirationAction{} + return pointer.To(cacheExpiration), true +} + +func AsDeliveryRuleRouteConfigurationOverrideAction(input rules.DeliveryRuleAction) (*rules.DeliveryRuleRouteConfigurationOverrideAction, bool) { + if input.DeliveryRuleAction().Name != rules.DeliveryRuleActionNameRouteConfigurationOverride { + return nil, false + } + + routeConfigurationOverride := rules.DeliveryRuleRouteConfigurationOverrideAction{} + return pointer.To(routeConfigurationOverride), true +} + +func AsDeliveryRuleResponseHeaderAction(input rules.DeliveryRuleAction) (*rules.DeliveryRuleResponseHeaderAction, bool) { + if input.DeliveryRuleAction().Name != rules.DeliveryRuleActionNameModifyResponseHeader { + return nil, false + } + + responseHeader := rules.DeliveryRuleResponseHeaderAction{} + return pointer.To(responseHeader), true +} + +func AsDeliveryRuleRequestHeaderAction(input rules.DeliveryRuleAction) (*rules.DeliveryRuleRequestHeaderAction, bool) { + if input.DeliveryRuleAction().Name != rules.DeliveryRuleActionNameModifyRequestHeader { + return nil, false + } + + requestHeader := rules.DeliveryRuleRequestHeaderAction{} + return pointer.To(requestHeader), true +} + +func AsDeliveryRuleUrlRewriteAction(input rules.DeliveryRuleAction) (*rules.URLRewriteAction, bool) { + if input.DeliveryRuleAction().Name != rules.DeliveryRuleActionNameURLRewrite { + return nil, false + } + + urlRewrite := rules.URLRewriteAction{} + return pointer.To(urlRewrite), true +} + +func AsDeliveryRuleUrlRedirectAction(input rules.DeliveryRuleAction) (*rules.URLRedirectAction, bool) { + if input.DeliveryRuleAction().Name != rules.DeliveryRuleActionNameURLRedirect { + return nil, false + } + + urlRedirect := rules.URLRedirectAction{} + return pointer.To(urlRedirect), true +} diff --git a/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_discriminator.go b/internal/services/cdn/frontdoordeliveryruleconditiondiscriminator/delivery_rule_condition_discriminator.go similarity index 72% rename from internal/services/cdn/deliveryruleconditions/delivery_rule_condition_discriminator.go rename to internal/services/cdn/frontdoordeliveryruleconditiondiscriminator/delivery_rule_condition_discriminator.go index 5b5c937ddb03..98ed40c1c7ab 100644 --- a/internal/services/cdn/deliveryruleconditions/delivery_rule_condition_discriminator.go +++ b/internal/services/cdn/frontdoordeliveryruleconditiondiscriminator/delivery_rule_condition_discriminator.go @@ -1,13 +1,17 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package deliveryruleconditions +package frontdoordeliveryruleconditiondiscriminator import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" ) +type FrontDoorDeliveryRuleCondition interface { + Evaluate(input string, Parameters map[string]interface{}) bool +} + func AsDeliveryRuleCookiesCondition(input rules.DeliveryRuleCondition) (*rules.CookiesMatchConditionParameters, bool) { if input.DeliveryRuleCondition().Name != rules.MatchVariableCookies { return nil, false @@ -133,3 +137,50 @@ func AsDeliveryRuleURLPathCondition(input rules.DeliveryRuleCondition) (*rules.U urlPathParameter := rules.URLPathMatchConditionParameters{} return pointer.To(urlPathParameter), true } + +func AsDeliveryRuleSslProtocolCondition(input rules.DeliveryRuleCondition) (*rules.SslProtocolMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableSslProtocol { + return nil, false + } + + sslProtocolParameter := rules.SslProtocolMatchConditionParameters{} + return pointer.To(sslProtocolParameter), true +} + +func AsDeliveryRuleSocketAddrCondition(input rules.DeliveryRuleCondition) (*rules.SocketAddrMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableSocketAddr { + return nil, false + } + + socketAddrParameter := rules.SocketAddrMatchConditionParameters{} + return pointer.To(socketAddrParameter), true +} + +func AsDeliveryRuleClientPortCondition(input rules.DeliveryRuleCondition) (*rules.ClientPortMatchConditionParameters, bool) { + // The input here has the data... + if input.DeliveryRuleCondition().Name != rules.MatchVariableClientPort { + return nil, false + } + + // need to pull the values out here... + clientPortParameter := rules.ClientPortMatchConditionParameters{} + return pointer.To(clientPortParameter), true +} + +func AsDeliveryRuleServerPortCondition(input rules.DeliveryRuleCondition) (*rules.ServerPortMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableServerPort { + return nil, false + } + + serverPortParameter := rules.ServerPortMatchConditionParameters{} + return pointer.To(serverPortParameter), true +} + +func AsDeliveryRuleHostNameCondition(input rules.DeliveryRuleCondition) (*rules.HostNameMatchConditionParameters, bool) { + if input.DeliveryRuleCondition().Name != rules.MatchVariableHostName { + return nil, false + } + + hostNametParameter := rules.HostNameMatchConditionParameters{} + return pointer.To(hostNametParameter), true +} diff --git a/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go b/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go index 0726e19a06c0..b6c08e362ad7 100644 --- a/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go +++ b/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go @@ -1,21 +1,23 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package CdnFrontDoorruleconditions +package cdnfrontdoorruleconditions import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck - "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" - cdnValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + helperValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoordeliveryruleconditiondiscriminator" + "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/utils" ) type CdnFrontDoorConditionParameters struct { - Name cdn.Name - TypeName string + Name rules.MatchVariable + TypeName rules.DeliveryRuleConditionParametersType ConfigName string } @@ -51,137 +53,137 @@ type normalizedCondition struct { operator string negateCondition *bool matchValues *[]string - transforms *[]cdn.Transform + transforms *[]rules.Transform } func InitializeCdnFrontDoorConditionMappings() *CdnFrontDoorCondtionsMappings { m := CdnFrontDoorCondtionsMappings{} m.ClientPort = CdnFrontDoorConditionParameters{ - Name: cdn.NameClientPort, - TypeName: "DeliveryRuleClientPortConditionParameters", + Name: rules.MatchVariableClientPort, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleClientPortConditionParameters, ConfigName: "client_port_condition", } m.Cookies = CdnFrontDoorConditionParameters{ - Name: cdn.NameCookies, - TypeName: "DeliveryRuleCookiesConditionParameters", + Name: rules.MatchVariableCookies, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleCookiesConditionParameters, ConfigName: "cookies_condition", } m.HostName = CdnFrontDoorConditionParameters{ - Name: cdn.NameHostName, - TypeName: "DeliveryRuleHostNameConditionParameters", + Name: rules.MatchVariableHostName, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleHostNameConditionParameters, ConfigName: "host_name_condition", } m.HttpVersion = CdnFrontDoorConditionParameters{ - Name: cdn.NameHTTPVersion, - TypeName: "DeliveryRuleHttpVersionConditionParameters", + Name: rules.MatchVariableHTTPVersion, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleHTTPVersionConditionParameters, ConfigName: "http_version_condition", } m.IsDevice = CdnFrontDoorConditionParameters{ - Name: cdn.NameIsDevice, - TypeName: "DeliveryRuleIsDeviceConditionParameters", + Name: rules.MatchVariableIsDevice, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters, ConfigName: "is_device_condition", } m.PostArgs = CdnFrontDoorConditionParameters{ - Name: cdn.NamePostArgs, - TypeName: "DeliveryRulePostArgsConditionParameters", + Name: rules.MatchVariablePostArgs, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRulePostArgsConditionParameters, ConfigName: "post_args_condition", } m.QueryString = CdnFrontDoorConditionParameters{ - Name: cdn.NameQueryString, - TypeName: "DeliveryRuleQueryStringConditionParameters", + Name: rules.MatchVariableQueryString, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleQueryStringConditionParameters, ConfigName: "query_string_condition", } m.RemoteAddress = CdnFrontDoorConditionParameters{ - Name: cdn.NameRemoteAddress, - TypeName: "DeliveryRuleRemoteAddressConditionParameters", + Name: rules.MatchVariableRemoteAddress, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRemoteAddressConditionParameters, ConfigName: "remote_address_condition", } m.RequestBody = CdnFrontDoorConditionParameters{ - Name: cdn.NameRequestBody, - TypeName: "DeliveryRuleRequestBodyConditionParameters", + Name: rules.MatchVariableRequestBody, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestBodyConditionParameters, ConfigName: "request_body_condition", } m.RequestHeader = CdnFrontDoorConditionParameters{ - Name: cdn.NameRequestHeader, - TypeName: "DeliveryRuleRequestHeaderConditionParameters", + Name: rules.MatchVariableRequestHeader, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestHeaderConditionParameters, ConfigName: "request_header_condition", } m.RequestMethod = CdnFrontDoorConditionParameters{ - Name: cdn.NameRequestMethod, - TypeName: "DeliveryRuleRequestMethodConditionParameters", + Name: rules.MatchVariableRequestMethod, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters, ConfigName: "request_method_condition", } m.RequestScheme = CdnFrontDoorConditionParameters{ - Name: cdn.NameRequestScheme, - TypeName: "DeliveryRuleRequestSchemeConditionParameters", + Name: rules.MatchVariableRequestScheme, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestSchemeConditionParameters, ConfigName: "request_scheme_condition", } m.RequestUri = CdnFrontDoorConditionParameters{ - Name: cdn.NameRequestURI, - TypeName: "DeliveryRuleRequestUriConditionParameters", + Name: rules.MatchVariableRequestUri, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestUriConditionParameters, ConfigName: "request_uri_condition", } m.ServerPort = CdnFrontDoorConditionParameters{ - Name: cdn.NameServerPort, - TypeName: "DeliveryRuleServerPortConditionParameters", + Name: rules.MatchVariableServerPort, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleServerPortConditionParameters, ConfigName: "server_port_condition", } m.SocketAddress = CdnFrontDoorConditionParameters{ - Name: cdn.NameSocketAddr, - TypeName: "DeliveryRuleSocketAddrConditionParameters", + Name: rules.MatchVariableSocketAddr, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleSocketAddrConditionParameters, ConfigName: "socket_address_condition", } m.SslProtocol = CdnFrontDoorConditionParameters{ - Name: cdn.NameSslProtocol, - TypeName: "DeliveryRuleSslProtocolConditionParameters", + Name: rules.MatchVariableSslProtocol, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleSslProtocolConditionParameters, ConfigName: "ssl_protocol_condition", } m.UrlFileExtension = CdnFrontDoorConditionParameters{ - Name: cdn.NameURLFileExtension, - TypeName: "DeliveryRuleUrlFileExtensionMatchConditionParameters", + Name: rules.MatchVariableURLFileExtension, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters, ConfigName: "url_file_extension_condition", } m.UrlFilename = CdnFrontDoorConditionParameters{ - Name: cdn.NameURLFileName, - TypeName: "DeliveryRuleUrlFilenameConditionParameters", + Name: rules.MatchVariableURLFileName, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleURLFilenameConditionParameters, ConfigName: "url_filename_condition", } m.UrlPath = CdnFrontDoorConditionParameters{ - Name: cdn.NameURLPath, - TypeName: "DeliveryRuleUrlPathMatchConditionParameters", + Name: rules.MatchVariableURLPath, + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleURLPathMatchConditionParameters, ConfigName: "url_path_condition", } return &m } -func expandNormalizeCdnFrontDoorTransforms(input []interface{}) []cdn.Transform { - transforms := make([]cdn.Transform, 0) +func expandNormalizeCdnFrontDoorTransforms(input []interface{}) []rules.Transform { + transforms := make([]rules.Transform, 0) if len(input) == 0 { return transforms } for _, t := range input { - transforms = append(transforms, cdn.Transform(t.(string))) + transforms = append(transforms, rules.Transform(t.(string))) } return transforms @@ -231,55 +233,56 @@ func validateCdnFrontDoorExpandConditionOperatorValues(operator string, matchVal return fmt.Errorf("%q is invalid: no 'operator' value has been set, got %q", m.ConfigName, operator) } - if operator == string(cdn.OperatorAny) && len(*matchValues) > 0 { + // NOTE: There are now 14 different "Any" operators in the new API, however they are all the same so I am just hardcoding this here now... + if operator == "Any" && len(*matchValues) > 0 { return fmt.Errorf("%q is invalid: the 'match_values' field must not be set if the conditions 'operator' is set to 'Any'", m.ConfigName) } // make the 'match_values' field required if the operator is not set to 'Any'... - if operator != string(cdn.OperatorAny) && len(*matchValues) == 0 { + if operator != "Any" && len(*matchValues) == 0 { return fmt.Errorf("%q is invalid: the 'match_values' field must be set if the conditions 'operator' is not set to 'Any'", m.ConfigName) } return nil } -func ExpandCdnFrontDoorRemoteAddressCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorRemoteAddressCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.RemoteAddress for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleRemoteAddressCondition{ + condition := rules.DeliveryRuleRemoteAddressCondition{ Name: conditionMapping.Name, - Parameters: &cdn.RemoteAddressMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.RemoteAddressOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.RemoteAddressMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.RemoteAddressOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } - if condition.Parameters.Operator == cdn.RemoteAddressOperatorGeoMatch { + if condition.Parameters.Operator == rules.RemoteAddressOperatorGeoMatch { for _, matchValue := range item["match_values"].([]interface{}) { if matchValue != nil { - if ok, _ := validate.RegExHelper(matchValue, "match_values", `^[A-Z]{2}$`); !ok { + if ok, _ := helperValidate.RegExHelper(matchValue, "match_values", `^[A-Z]{2}$`); !ok { return nil, fmt.Errorf("%q is invalid: when the 'operator' is set to 'GeoMatch' the value must be a valid country code consisting of 2 uppercase characters, got %q", conditionMapping.ConfigName, matchValue) } } } } - if condition.Parameters.Operator == cdn.RemoteAddressOperatorIPMatch { + if condition.Parameters.Operator == rules.RemoteAddressOperatorIPMatch { // make sure all of the passed CIDRs are valid for _, matchValue := range item["match_values"].([]interface{}) { - if _, err := cdnValidate.FrontDoorRuleCidrIsValid(matchValue, "match_values"); err != nil { + if _, err := validate.FrontDoorRuleCidrIsValid(matchValue, "match_values"); err != nil { return nil, fmt.Errorf("%q is invalid: when the 'operator' is set to 'IPMatch' the 'match_values' must be a valid IPv4 or IPv6 CIDR, got %q", conditionMapping.ConfigName, matchValue.(string)) } } // Check for CIDR overlap and CIDR duplicates in the match values - _, err := cdnValidate.FrontDoorRuleCidrOverlap(item["match_values"].([]interface{}), "match_values") + _, err := validate.FrontDoorRuleCidrOverlap(item["match_values"].([]interface{}), "match_values") if err != nil { return nil, fmt.Errorf("%q is invalid: %+v", conditionMapping.ConfigName, err) } @@ -295,8 +298,8 @@ func ExpandCdnFrontDoorRemoteAddressCondition(input []interface{}) (*[]cdn.Basic return &output, nil } -func ExpandCdnFrontDoorRequestMethodCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorRequestMethodCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.RequestMethod @@ -304,17 +307,17 @@ func ExpandCdnFrontDoorRequestMethodCondition(input []interface{}) (*[]cdn.Basic item := v.(map[string]interface{}) matchValuesRaw := item["match_values"].(*pluginsdk.Set).List() - condition := cdn.DeliveryRuleRequestMethodCondition{ + condition := rules.DeliveryRuleRequestMethodCondition{ Name: conditionMapping.Name, - Parameters: &cdn.RequestMethodMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: utils.String(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), - MatchValues: utils.ExpandStringSlice(matchValuesRaw), + Parameters: rules.RequestMethodMatchConditionParameters{ + TypeName: rules.DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters, + Operator: rules.RequestMethodOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), + MatchValues: expandRequestMethodMatchValues(matchValuesRaw), }, } - if err := validateCdnFrontDoorExpandConditionOperatorValues(*condition.Parameters.Operator, condition.Parameters.MatchValues, conditionMapping); err != nil { + if err := validateCdnFrontDoorExpandConditionOperatorValues(string(condition.Parameters.Operator), utils.ExpandStringSlice(matchValuesRaw), conditionMapping); err != nil { return nil, err } @@ -324,19 +327,19 @@ func ExpandCdnFrontDoorRequestMethodCondition(input []interface{}) (*[]cdn.Basic return &output, nil } -func ExpandCdnFrontDoorQueryStringCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorQueryStringCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.QueryString for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleQueryStringCondition{ + condition := rules.DeliveryRuleQueryStringCondition{ Name: conditionMapping.Name, - Parameters: &cdn.QueryStringMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.QueryStringOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.QueryStringMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.QueryStringOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -357,20 +360,20 @@ func ExpandCdnFrontDoorQueryStringCondition(input []interface{}) (*[]cdn.BasicDe return &output, nil } -func ExpandCdnFrontDoorPostArgsCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorPostArgsCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.PostArgs for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRulePostArgsCondition{ + condition := rules.DeliveryRulePostArgsCondition{ Name: conditionMapping.Name, - Parameters: &cdn.PostArgsMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Selector: utils.String(item["post_args_name"].(string)), - Operator: cdn.PostArgsOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.PostArgsMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Selector: pointer.To(item["post_args_name"].(string)), + Operator: rules.PostArgsOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -391,19 +394,19 @@ func ExpandCdnFrontDoorPostArgsCondition(input []interface{}) (*[]cdn.BasicDeliv return &output, nil } -func ExpandCdnFrontDoorRequestUriCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorRequestUriCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.RequestUri for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleRequestURICondition{ + condition := rules.DeliveryRuleRequestUriCondition{ Name: conditionMapping.Name, - Parameters: &cdn.RequestURIMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.RequestURIOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.RequestUriMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.RequestUriOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -424,20 +427,20 @@ func ExpandCdnFrontDoorRequestUriCondition(input []interface{}) (*[]cdn.BasicDel return &output, nil } -func ExpandCdnFrontDoorRequestHeaderCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorRequestHeaderCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.RequestHeader for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleRequestHeaderCondition{ + condition := rules.DeliveryRuleRequestHeaderCondition{ Name: conditionMapping.Name, - Parameters: &cdn.RequestHeaderMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Selector: utils.String(item["header_name"].(string)), - Operator: cdn.RequestHeaderOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.RequestHeaderMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Selector: pointer.To(item["header_name"].(string)), + Operator: rules.RequestHeaderOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -458,19 +461,19 @@ func ExpandCdnFrontDoorRequestHeaderCondition(input []interface{}) (*[]cdn.Basic return &output, nil } -func ExpandCdnFrontDoorRequestBodyCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorRequestBodyCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.RequestBody for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleRequestBodyCondition{ + condition := rules.DeliveryRuleRequestBodyCondition{ Name: conditionMapping.Name, - Parameters: &cdn.RequestBodyMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.RequestBodyOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.RequestBodyMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.RequestBodyOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -491,24 +494,26 @@ func ExpandCdnFrontDoorRequestBodyCondition(input []interface{}) (*[]cdn.BasicDe return &output, nil } -func ExpandCdnFrontDoorRequestSchemeCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorRequestSchemeCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.RequestScheme for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleRequestSchemeCondition{ + matchValuesRaw := item["match_values"].([]interface{}) + + condition := rules.DeliveryRuleRequestSchemeCondition{ Name: conditionMapping.Name, - Parameters: &cdn.RequestSchemeMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: utils.String(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), - MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), + Parameters: rules.RequestSchemeMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.Operator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), + MatchValues: expandRequestSchemeMatchValues(matchValuesRaw), }, } - if err := validateCdnFrontDoorExpandConditionOperatorValues(*condition.Parameters.Operator, condition.Parameters.MatchValues, conditionMapping); err != nil { + if err := validateCdnFrontDoorExpandConditionOperatorValues(string(condition.Parameters.Operator), utils.ExpandStringSlice(matchValuesRaw), conditionMapping); err != nil { return nil, err } @@ -518,19 +523,19 @@ func ExpandCdnFrontDoorRequestSchemeCondition(input []interface{}) (*[]cdn.Basic return &output, nil } -func ExpandCdnFrontDoorUrlPathCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorUrlPathCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.UrlPath for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleURLPathCondition{ + condition := rules.DeliveryRuleURLPathCondition{ Name: conditionMapping.Name, - Parameters: &cdn.URLPathMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.URLPathOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.URLPathMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.URLPathOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -551,19 +556,19 @@ func ExpandCdnFrontDoorUrlPathCondition(input []interface{}) (*[]cdn.BasicDelive return &output, nil } -func ExpandCdnFrontDoorUrlFileExtensionCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorUrlFileExtensionCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.UrlFileExtension for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleURLFileExtensionCondition{ + condition := rules.DeliveryRuleURLFileExtensionCondition{ Name: conditionMapping.Name, - Parameters: &cdn.URLFileExtensionMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.URLFileExtensionOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.URLFileExtensionMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.URLFileExtensionOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -584,19 +589,19 @@ func ExpandCdnFrontDoorUrlFileExtensionCondition(input []interface{}) (*[]cdn.Ba return &output, nil } -func ExpandCdnFrontDoorUrlFileNameCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorUrlFileNameCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.UrlFilename for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleURLFileNameCondition{ + condition := rules.DeliveryRuleURLFileNameCondition{ Name: conditionMapping.Name, - Parameters: &cdn.URLFileNameMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.URLFileNameOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.URLFileNameMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.URLFileNameOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -617,8 +622,8 @@ func ExpandCdnFrontDoorUrlFileNameCondition(input []interface{}) (*[]cdn.BasicDe return &output, nil } -func ExpandCdnFrontDoorHttpVersionCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorHttpVersionCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.HttpVersion @@ -626,17 +631,17 @@ func ExpandCdnFrontDoorHttpVersionCondition(input []interface{}) (*[]cdn.BasicDe item := v.(map[string]interface{}) matchValuesRaw := item["match_values"].(*pluginsdk.Set).List() - condition := cdn.DeliveryRuleHTTPVersionCondition{ + condition := rules.DeliveryRuleHTTPVersionCondition{ Name: conditionMapping.Name, - Parameters: &cdn.HTTPVersionMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: utils.String(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.HTTPVersionMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.HTTPVersionOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(matchValuesRaw), }, } - if err := validateCdnFrontDoorExpandConditionOperatorValues(*condition.Parameters.Operator, condition.Parameters.MatchValues, conditionMapping); err != nil { + if err := validateCdnFrontDoorExpandConditionOperatorValues(string(condition.Parameters.Operator), condition.Parameters.MatchValues, conditionMapping); err != nil { return nil, err } @@ -646,20 +651,20 @@ func ExpandCdnFrontDoorHttpVersionCondition(input []interface{}) (*[]cdn.BasicDe return &output, nil } -func ExpandCdnFrontDoorCookiesCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorCookiesCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.Cookies for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleCookiesCondition{ + condition := rules.DeliveryRuleCookiesCondition{ Name: conditionMapping.Name, - Parameters: &cdn.CookiesMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Selector: utils.String(item["cookie_name"].(string)), - Operator: cdn.CookiesOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.CookiesMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Selector: pointer.To(item["cookie_name"].(string)), + Operator: rules.CookiesOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -680,24 +685,26 @@ func ExpandCdnFrontDoorCookiesCondition(input []interface{}) (*[]cdn.BasicDelive return &output, nil } -func ExpandCdnFrontDoorIsDeviceCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorIsDeviceCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.IsDevice for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleIsDeviceCondition{ + matchValuesRaw := item["match_values"].([]interface{}) + + condition := rules.DeliveryRuleIsDeviceCondition{ Name: conditionMapping.Name, - Parameters: &cdn.IsDeviceMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: utils.String(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), - MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), + Parameters: rules.IsDeviceMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.IsDeviceOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), + MatchValues: expandIsDeviceMatchValues(matchValuesRaw), }, } - if err := validateCdnFrontDoorExpandConditionOperatorValues(*condition.Parameters.Operator, condition.Parameters.MatchValues, conditionMapping); err != nil { + if err := validateCdnFrontDoorExpandConditionOperatorValues(string(condition.Parameters.Operator), utils.ExpandStringSlice(matchValuesRaw), conditionMapping); err != nil { return nil, err } @@ -707,33 +714,33 @@ func ExpandCdnFrontDoorIsDeviceCondition(input []interface{}) (*[]cdn.BasicDeliv return &output, nil } -func ExpandCdnFrontDoorSocketAddressCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorSocketAddressCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.SocketAddress for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleSocketAddrCondition{ + condition := rules.DeliveryRuleSocketAddrCondition{ Name: conditionMapping.Name, - Parameters: &cdn.SocketAddrMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.SocketAddrOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.SocketAddrMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.SocketAddrOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } - if condition.Parameters.Operator == cdn.SocketAddrOperatorIPMatch { + if condition.Parameters.Operator == rules.SocketAddrOperatorIPMatch { // make sure all of the passed CIDRs are valid for _, matchValue := range item["match_values"].([]interface{}) { - if _, err := cdnValidate.FrontDoorRuleCidrIsValid(matchValue, "match_values"); err != nil { + if _, err := validate.FrontDoorRuleCidrIsValid(matchValue, "match_values"); err != nil { return nil, fmt.Errorf("%q is invalid: when the 'operator' is set to 'IPMatch' the 'match_values' must be a valid IPv4 or IPv6 CIDR, got %q", conditionMapping.ConfigName, matchValue.(string)) } } // Check for CIDR overlap and CIDR duplicates in the match values - _, err := cdnValidate.FrontDoorRuleCidrOverlap(item["match_values"].([]interface{}), "match_values") + _, err := validate.FrontDoorRuleCidrOverlap(item["match_values"].([]interface{}), "match_values") if err != nil { return nil, fmt.Errorf("%q is invalid: %+v", conditionMapping.ConfigName, err) } @@ -749,19 +756,19 @@ func ExpandCdnFrontDoorSocketAddressCondition(input []interface{}) (*[]cdn.Basic return &output, nil } -func ExpandCdnFrontDoorClientPortCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorClientPortCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.ClientPort for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleClientPortCondition{ + condition := rules.DeliveryRuleClientPortCondition{ Name: conditionMapping.Name, - Parameters: &cdn.ClientPortMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.ClientPortOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.ClientPortMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.ClientPortOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -776,8 +783,8 @@ func ExpandCdnFrontDoorClientPortCondition(input []interface{}) (*[]cdn.BasicDel return &output, nil } -func ExpandCdnFrontDoorServerPortCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorServerPortCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.ServerPort @@ -785,12 +792,12 @@ func ExpandCdnFrontDoorServerPortCondition(input []interface{}) (*[]cdn.BasicDel item := v.(map[string]interface{}) matchValuesRaw := item["match_values"].(*pluginsdk.Set).List() - condition := cdn.DeliveryRuleServerPortCondition{ + condition := rules.DeliveryRuleServerPortCondition{ Name: conditionMapping.Name, - Parameters: &cdn.ServerPortMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.ServerPortOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.ServerPortMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.ServerPortOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(matchValuesRaw), }, } @@ -805,19 +812,19 @@ func ExpandCdnFrontDoorServerPortCondition(input []interface{}) (*[]cdn.BasicDel return &output, nil } -func ExpandCdnFrontDoorHostNameCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorHostNameCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.HostName for _, v := range input { item := v.(map[string]interface{}) - condition := cdn.DeliveryRuleHostNameCondition{ + condition := rules.DeliveryRuleHostNameCondition{ Name: conditionMapping.Name, - Parameters: &cdn.HostNameMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: cdn.HostNameOperator(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.HostNameMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.HostNameOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: utils.ExpandStringSlice(item["match_values"].([]interface{})), }, } @@ -838,34 +845,34 @@ func ExpandCdnFrontDoorHostNameCondition(input []interface{}) (*[]cdn.BasicDeliv return &output, nil } -func ExpandCdnFrontDoorSslProtocolCondition(input []interface{}) (*[]cdn.BasicDeliveryRuleCondition, error) { - output := make([]cdn.BasicDeliveryRuleCondition, 0) +func ExpandCdnFrontDoorSslProtocolCondition(input []interface{}) (*[]rules.DeliveryRuleCondition, error) { + output := make([]rules.DeliveryRuleCondition, 0) m := InitializeCdnFrontDoorConditionMappings() conditionMapping := m.SslProtocol for _, v := range input { item := v.(map[string]interface{}) - matchValues := make([]cdn.SslProtocol, 0) + matchValues := make([]rules.SslProtocol, 0) validationMatchValues := make([]string, 0) matchValuesRaw := item["match_values"].(*pluginsdk.Set).List() for _, value := range matchValuesRaw { - matchValues = append(matchValues, cdn.SslProtocol(value.(string))) + matchValues = append(matchValues, rules.SslProtocol(value.(string))) validationMatchValues = append(validationMatchValues, value.(string)) } - condition := cdn.DeliveryRuleSslProtocolCondition{ + condition := rules.DeliveryRuleSslProtocolCondition{ Name: conditionMapping.Name, - Parameters: &cdn.SslProtocolMatchConditionParameters{ - TypeName: utils.String(conditionMapping.TypeName), - Operator: utils.String(item["operator"].(string)), - NegateCondition: utils.Bool(item["negate_condition"].(bool)), + Parameters: rules.SslProtocolMatchConditionParameters{ + TypeName: conditionMapping.TypeName, + Operator: rules.SslProtocolOperator(item["operator"].(string)), + NegateCondition: pointer.To(item["negate_condition"].(bool)), MatchValues: &matchValues, }, } - if err := validateCdnFrontDoorExpandConditionOperatorValues(*condition.Parameters.Operator, &validationMatchValues, conditionMapping); err != nil { + if err := validateCdnFrontDoorExpandConditionOperatorValues(string(condition.Parameters.Operator), &validationMatchValues, conditionMapping); err != nil { return nil, err } @@ -875,15 +882,15 @@ func ExpandCdnFrontDoorSslProtocolCondition(input []interface{}) (*[]cdn.BasicDe return &output, nil } -func FlattenFrontdoorRemoteAddressCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRemoteAddressCondition() +func FlattenFrontdoorRemoteAddressCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleRemoteAddressCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule remote address condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -896,20 +903,20 @@ func FlattenFrontdoorRemoteAddressCondition(input cdn.BasicDeliveryRuleCondition return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorRequestMethodCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestMethodCondition() +func FlattenFrontdoorRequestMethodCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleRequestMethodCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request method condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, - operator: *params.Operator, + operator: string(params.Operator), negateCondition: params.NegateCondition, - matchValues: params.MatchValues, + matchValues: flattenRequestMethodMatchValues(params.MatchValues), transforms: nil, } } @@ -917,15 +924,15 @@ func FlattenFrontdoorRequestMethodCondition(input cdn.BasicDeliveryRuleCondition return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorQueryStringCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleQueryStringCondition() +func FlattenFrontdoorQueryStringCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleQueryStringCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule query string condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -938,17 +945,17 @@ func FlattenFrontdoorQueryStringCondition(input cdn.BasicDeliveryRuleCondition) return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorPostArgsCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRulePostArgsCondition() +func FlattenFrontdoorPostArgsCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRulePostArgsCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule post args condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ - selector: &normalizedSelector{name: utils.String("post_args_name"), value: params.Selector}, + selector: &normalizedSelector{name: pointer.To("post_args_name"), value: params.Selector}, operator: string(params.Operator), negateCondition: params.NegateCondition, matchValues: params.MatchValues, @@ -959,15 +966,15 @@ func FlattenFrontdoorPostArgsCondition(input cdn.BasicDeliveryRuleCondition) (ma return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorRequestUriCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestURICondition() +func FlattenFrontdoorRequestUriCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleRequestUriCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request URI condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -980,17 +987,17 @@ func FlattenFrontdoorRequestUriCondition(input cdn.BasicDeliveryRuleCondition) ( return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorRequestHeaderCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestHeaderCondition() +func FlattenFrontdoorRequestHeaderCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleRequestHeaderCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request header condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ - selector: &normalizedSelector{name: utils.String("header_name"), value: params.Selector}, + selector: &normalizedSelector{name: pointer.To("header_name"), value: params.Selector}, operator: string(params.Operator), negateCondition: params.NegateCondition, matchValues: params.MatchValues, @@ -1001,15 +1008,15 @@ func FlattenFrontdoorRequestHeaderCondition(input cdn.BasicDeliveryRuleCondition return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorRequestBodyCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestBodyCondition() +func FlattenFrontdoorRequestBodyCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleRequestBodyCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request body condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -1022,20 +1029,20 @@ func FlattenFrontdoorRequestBodyCondition(input cdn.BasicDeliveryRuleCondition) return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorRequestSchemeCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleRequestSchemeCondition() +func FlattenFrontdoorRequestSchemeCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleRequestSchemeCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule request scheme condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, - operator: *params.Operator, + operator: string(params.Operator), negateCondition: params.NegateCondition, - matchValues: params.MatchValues, + matchValues: flattenRequestSchemeMatchValues(params.MatchValues), transforms: nil, } } @@ -1043,15 +1050,15 @@ func FlattenFrontdoorRequestSchemeCondition(input cdn.BasicDeliveryRuleCondition return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorUrlPathCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleURLPathCondition() +func FlattenFrontdoorUrlPathCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleURLPathCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule url path condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -1064,15 +1071,15 @@ func FlattenFrontdoorUrlPathCondition(input cdn.BasicDeliveryRuleCondition) (map return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorUrlFileExtensionCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleURLFileExtensionCondition() +func FlattenFrontdoorUrlFileExtensionCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleURLFileExtensionCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule url file extension condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -1085,15 +1092,15 @@ func FlattenFrontdoorUrlFileExtensionCondition(input cdn.BasicDeliveryRuleCondit return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorUrlFileNameCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleURLFileNameCondition() +func FlattenFrontdoorUrlFileNameCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleURLFileNameCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule url file name condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -1106,18 +1113,18 @@ func FlattenFrontdoorUrlFileNameCondition(input cdn.BasicDeliveryRuleCondition) return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorHttpVersionCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleHTTPVersionCondition() +func FlattenFrontdoorHttpVersionCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleHTTPVersionCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule http version condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, - operator: *params.Operator, + operator: string(params.Operator), negateCondition: params.NegateCondition, matchValues: params.MatchValues, transforms: nil, @@ -1127,8 +1134,8 @@ func FlattenFrontdoorHttpVersionCondition(input cdn.BasicDeliveryRuleCondition) return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorCookiesCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleCookiesCondition() +func FlattenFrontdoorCookiesCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleCookiesCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule cookie condition") } @@ -1137,9 +1144,9 @@ func FlattenFrontdoorCookiesCondition(input cdn.BasicDeliveryRuleCondition) (map normalized := createCdnFrontDoorNormalizedConditionStub() // if this has values override the stub values for the actual values - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ - selector: &normalizedSelector{name: utils.String("cookie_name"), value: params.Selector}, + selector: &normalizedSelector{name: pointer.To("cookie_name"), value: params.Selector}, operator: string(params.Operator), negateCondition: params.NegateCondition, matchValues: params.MatchValues, @@ -1151,20 +1158,20 @@ func FlattenFrontdoorCookiesCondition(input cdn.BasicDeliveryRuleCondition) (map return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorIsDeviceCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleIsDeviceCondition() +func FlattenFrontdoorIsDeviceCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleIsDeviceCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule is device condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, - operator: *params.Operator, + operator: string(params.Operator), negateCondition: params.NegateCondition, - matchValues: params.MatchValues, + matchValues: flattenIsDeviceMatchValues(params.MatchValues), transforms: nil, } } @@ -1172,15 +1179,15 @@ func FlattenFrontdoorIsDeviceCondition(input cdn.BasicDeliveryRuleCondition) (ma return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorSocketAddressCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleSocketAddrCondition() +func FlattenFrontdoorSocketAddressCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleSocketAddrCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule socket address condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -1193,36 +1200,35 @@ func FlattenFrontdoorSocketAddressCondition(input cdn.BasicDeliveryRuleCondition return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorClientPortCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleClientPortCondition() +func FlattenFrontdoorClientPortCondition(input *rules.DeliveryRuleClientPortCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleClientPortCondition(pointer.From(input)) if !ok { return nil, fmt.Errorf("expected a delivery rule client port condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: nil, - } + params := pointer.From(condition) + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: nil, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorServerPortCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleServerPortCondition() +func FlattenFrontdoorServerPortCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleServerPortCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule server port condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -1235,15 +1241,15 @@ func FlattenFrontdoorServerPortCondition(input cdn.BasicDeliveryRuleCondition) ( return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorHostNameCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleHostNameCondition() +func FlattenFrontdoorHostNameCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleHostNameCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule host name condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -1256,15 +1262,15 @@ func FlattenFrontdoorHostNameCondition(input cdn.BasicDeliveryRuleCondition) (ma return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func FlattenFrontdoorSslProtocolCondition(input cdn.BasicDeliveryRuleCondition) (map[string]interface{}, error) { - condition, ok := input.AsDeliveryRuleSslProtocolCondition() +func FlattenFrontdoorSslProtocolCondition(input rules.DeliveryRuleCondition) (map[string]interface{}, error) { + condition, ok := frontdoordeliveryruleconditiondiscriminator.AsDeliveryRuleSslProtocolCondition(input) if !ok { return nil, fmt.Errorf("expected a delivery rule ssl protocol condition") } normalized := createCdnFrontDoorNormalizedConditionStub() - if params := condition.Parameters; params != nil { + if params := condition; params != nil { matchValues := make([]string, 0) for _, value := range *params.MatchValues { matchValues = append(matchValues, string(value)) @@ -1272,7 +1278,7 @@ func FlattenFrontdoorSslProtocolCondition(input cdn.BasicDeliveryRuleCondition) normalized = normalizedCondition{ selector: nil, - operator: *params.Operator, + operator: string(params.Operator), negateCondition: params.NegateCondition, matchValues: &matchValues, transforms: nil, @@ -1288,10 +1294,96 @@ func createCdnFrontDoorNormalizedConditionStub() normalizedCondition { stub := normalizedCondition{ selector: nil, operator: "", - negateCondition: utils.Bool(false), + negateCondition: pointer.To(false), matchValues: &matchValues, transforms: nil, } return stub } + +// TODO: Consolidate redundant helper code, also exposed in deliveryruleconditions/delivery_ruleconditions_helper.go + +func expandRequestMethodMatchValues(input []interface{}) *[]rules.RequestMethodMatchValue { + result := make([]rules.RequestMethodMatchValue, 0) + if len(input) == 0 { + return nil + } + + for _, v := range input { + matchValue := v.(string) + result = append(result, rules.RequestMethodMatchValue(matchValue)) + } + + return &result +} + +func flattenRequestMethodMatchValues(input *[]rules.RequestMethodMatchValue) *[]string { + result := make([]string, 0) + if input == nil { + return nil + } + + for _, v := range *input { + matchValue := string(v) + result = append(result, matchValue) + } + + return &result +} + +func expandRequestSchemeMatchValues(input []interface{}) *[]rules.RequestSchemeMatchValue { + result := make([]rules.RequestSchemeMatchValue, 0) + if len(input) == 0 { + return nil + } + + for _, v := range input { + matchValue := v.(string) + result = append(result, rules.RequestSchemeMatchValue(matchValue)) + } + + return &result +} + +func flattenRequestSchemeMatchValues(input *[]rules.RequestSchemeMatchValue) *[]string { + result := make([]string, 0) + if input == nil { + return nil + } + + for _, v := range *input { + matchValue := string(v) + result = append(result, matchValue) + } + + return &result +} + +func expandIsDeviceMatchValues(input []interface{}) *[]rules.IsDeviceMatchValue { + result := make([]rules.IsDeviceMatchValue, 0) + if len(input) == 0 { + return nil + } + + for _, v := range input { + matchValue := v.(string) + result = append(result, rules.IsDeviceMatchValue(matchValue)) + } + + return &result +} + +func flattenIsDeviceMatchValues(input *[]rules.IsDeviceMatchValue) *[]string { + result := make([]string, 0) + if input == nil { + return nil + } + + for _, v := range *input { + matchValue := string(v) + result = append(result, matchValue) + } + + return &result +} diff --git a/internal/services/cdn/validate/front_door_route_https_redirect.go b/internal/services/cdn/validate/front_door_route_https_redirect.go index bb6f9b1f94c7..140d5ce56464 100644 --- a/internal/services/cdn/validate/front_door_route_https_redirect.go +++ b/internal/services/cdn/validate/front_door_route_https_redirect.go @@ -6,7 +6,7 @@ package validate import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -23,7 +23,7 @@ func SupportsBothHttpAndHttps(input []interface{}, key string) error { } protocols := utils.ExpandStringSlice(input) - if !utils.SliceContainsValue(*protocols, string(cdn.AFDEndpointProtocolsHTTP)) || !utils.SliceContainsValue(*protocols, string(cdn.AFDEndpointProtocolsHTTPS)) { + if !utils.SliceContainsValue(*protocols, string(endpoints.DestinationProtocolHTTP)) || !utils.SliceContainsValue(*protocols, string(endpoints.DestinationProtocolHTTPS)) { return fmt.Errorf("'https_redirect_enabled' and 'supported_protocols' conflict. The 'https_redirect_enabled' field cannot be set to 'true' unless the 'supported_protocols' field contains both 'Http' and 'Https'") } diff --git a/internal/services/cdn/validate/front_door_security_policy_domain_id.go b/internal/services/cdn/validate/front_door_security_policy_domain_id.go index 8b6fac079710..b292081f876d 100644 --- a/internal/services/cdn/validate/front_door_security_policy_domain_id.go +++ b/internal/services/cdn/validate/front_door_security_policy_domain_id.go @@ -28,14 +28,12 @@ func FrontDoorSecurityPolicyDomainID(i interface{}, k string) (_ []string, error // Fix for issue #18551: If the ID failed to parse try it again but case insensitively. // I believe this is ok because it is just a pass through value and the service doesn't care // about the passed values casing... - if err != nil { - if _, err := parse.FrontDoorCustomDomainIDInsensitively(v); err == nil { - return nil, nil - } - - if _, err := parse.FrontDoorEndpointIDInsensitively(v); err == nil { - return nil, nil - } + if _, err := parse.FrontDoorCustomDomainIDInsensitively(v); err == nil { + return nil, nil + } + + if _, err := parse.FrontDoorEndpointIDInsensitively(v); err == nil { + return nil, nil } return nil, []error{fmt.Errorf("%q is invalid: the %q needs to be a valid CDN Front Door Custom Domain ID or a valid CDN Front Door Endpoint ID: Unable to parse passed domain resource ID value %q", "domain", k, v)} diff --git a/internal/services/cdn/validate/front_door_validation_helpers.go b/internal/services/cdn/validate/front_door_validation_helpers.go index c913d9440981..9dbdb4f7ab8d 100644 --- a/internal/services/cdn/validate/front_door_validation_helpers.go +++ b/internal/services/cdn/validate/front_door_validation_helpers.go @@ -8,8 +8,9 @@ import ( "strconv" "strings" - "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/rules" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoordeliveryruleactiondiscriminator" ) func CdnFrontDoorRouteName(i interface{}, k string) (_ []string, errors []error) { @@ -87,7 +88,7 @@ func CdnFrontDoorSecretName(i interface{}, k string) (_ []string, errors []error return nil, nil } -func CdnFrontDoorActionsBlock(actions []cdn.BasicDeliveryRuleAction) error { +func CdnFrontDoorActionsBlock(actions []rules.DeliveryRuleAction) error { routeConfigurationOverride := false responseHeader := false requestHeader := false @@ -96,23 +97,23 @@ func CdnFrontDoorActionsBlock(actions []cdn.BasicDeliveryRuleAction) error { for _, rule := range actions { if !routeConfigurationOverride { - _, routeConfigurationOverride = rule.AsDeliveryRuleRouteConfigurationOverrideAction() + _, routeConfigurationOverride = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleRouteConfigurationOverrideAction(rule) } if !responseHeader { - _, responseHeader = rule.AsDeliveryRuleResponseHeaderAction() + _, responseHeader = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleResponseHeaderAction(rule) } if !requestHeader { - _, requestHeader = rule.AsDeliveryRuleRequestHeaderAction() + _, requestHeader = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleRequestHeaderAction(rule) } if !urlRewrite { - _, urlRewrite = rule.AsURLRewriteAction() + _, urlRewrite = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleUrlRewriteAction(rule) } if !urlRedirect { - _, urlRedirect = rule.AsURLRedirectAction() + _, urlRedirect = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleUrlRedirectAction(rule) } } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/README.md new file mode 100644 index 000000000000..61a41cfb227b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/README.md @@ -0,0 +1,195 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints` Documentation + +The `endpoints` 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/endpoints" +``` + + +### Client Initialization + +```go +client := endpoints.NewEndpointsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `EndpointsClient.Create` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +payload := endpoints.Endpoint{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `EndpointsClient.Delete` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `EndpointsClient.Get` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +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: `EndpointsClient.ListByProfile` + +```go +ctx := context.TODO() +id := endpoints.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: `EndpointsClient.ListResourceUsage` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +// 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: `EndpointsClient.LoadContent` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +payload := endpoints.LoadParameters{ + // ... +} + + +if err := client.LoadContentThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `EndpointsClient.PurgeContent` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +payload := endpoints.PurgeParameters{ + // ... +} + + +if err := client.PurgeContentThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `EndpointsClient.Start` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `EndpointsClient.Stop` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +if err := client.StopThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `EndpointsClient.Update` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +payload := endpoints.EndpointUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `EndpointsClient.ValidateCustomDomain` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "endpointName") + +payload := endpoints.ValidateCustomDomainInput{ + // ... +} + + +read, err := client.ValidateCustomDomain(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/client.go new file mode 100644 index 000000000000..754a364cd33a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/client.go @@ -0,0 +1,26 @@ +package endpoints + +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 EndpointsClient struct { + Client *resourcemanager.Client +} + +func NewEndpointsClientWithBaseURI(sdkApi sdkEnv.Api) (*EndpointsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "endpoints", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating EndpointsClient: %+v", err) + } + + return &EndpointsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/constants.go new file mode 100644 index 000000000000..489637e32e3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/constants.go @@ -0,0 +1,2629 @@ +package endpoints + +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 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 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 EndpointProvisioningState string + +const ( + EndpointProvisioningStateCreating EndpointProvisioningState = "Creating" + EndpointProvisioningStateDeleting EndpointProvisioningState = "Deleting" + EndpointProvisioningStateFailed EndpointProvisioningState = "Failed" + EndpointProvisioningStateSucceeded EndpointProvisioningState = "Succeeded" + EndpointProvisioningStateUpdating EndpointProvisioningState = "Updating" +) + +func PossibleValuesForEndpointProvisioningState() []string { + return []string{ + string(EndpointProvisioningStateCreating), + string(EndpointProvisioningStateDeleting), + string(EndpointProvisioningStateFailed), + string(EndpointProvisioningStateSucceeded), + string(EndpointProvisioningStateUpdating), + } +} + +func (s *EndpointProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEndpointProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEndpointProvisioningState(input string) (*EndpointProvisioningState, error) { + vals := map[string]EndpointProvisioningState{ + "creating": EndpointProvisioningStateCreating, + "deleting": EndpointProvisioningStateDeleting, + "failed": EndpointProvisioningStateFailed, + "succeeded": EndpointProvisioningStateSucceeded, + "updating": EndpointProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointProvisioningState(input) + return &out, nil +} + +type EndpointResourceState string + +const ( + EndpointResourceStateCreating EndpointResourceState = "Creating" + EndpointResourceStateDeleting EndpointResourceState = "Deleting" + EndpointResourceStateRunning EndpointResourceState = "Running" + EndpointResourceStateStarting EndpointResourceState = "Starting" + EndpointResourceStateStopped EndpointResourceState = "Stopped" + EndpointResourceStateStopping EndpointResourceState = "Stopping" +) + +func PossibleValuesForEndpointResourceState() []string { + return []string{ + string(EndpointResourceStateCreating), + string(EndpointResourceStateDeleting), + string(EndpointResourceStateRunning), + string(EndpointResourceStateStarting), + string(EndpointResourceStateStopped), + string(EndpointResourceStateStopping), + } +} + +func (s *EndpointResourceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEndpointResourceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEndpointResourceState(input string) (*EndpointResourceState, error) { + vals := map[string]EndpointResourceState{ + "creating": EndpointResourceStateCreating, + "deleting": EndpointResourceStateDeleting, + "running": EndpointResourceStateRunning, + "starting": EndpointResourceStateStarting, + "stopped": EndpointResourceStateStopped, + "stopping": EndpointResourceStateStopping, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointResourceState(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 GeoFilterActions string + +const ( + GeoFilterActionsAllow GeoFilterActions = "Allow" + GeoFilterActionsBlock GeoFilterActions = "Block" +) + +func PossibleValuesForGeoFilterActions() []string { + return []string{ + string(GeoFilterActionsAllow), + string(GeoFilterActionsBlock), + } +} + +func (s *GeoFilterActions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGeoFilterActions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGeoFilterActions(input string) (*GeoFilterActions, error) { + vals := map[string]GeoFilterActions{ + "allow": GeoFilterActionsAllow, + "block": GeoFilterActionsBlock, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GeoFilterActions(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 HealthProbeRequestType string + +const ( + HealthProbeRequestTypeGET HealthProbeRequestType = "GET" + HealthProbeRequestTypeHEAD HealthProbeRequestType = "HEAD" + HealthProbeRequestTypeNotSet HealthProbeRequestType = "NotSet" +) + +func PossibleValuesForHealthProbeRequestType() []string { + return []string{ + string(HealthProbeRequestTypeGET), + string(HealthProbeRequestTypeHEAD), + string(HealthProbeRequestTypeNotSet), + } +} + +func (s *HealthProbeRequestType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHealthProbeRequestType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHealthProbeRequestType(input string) (*HealthProbeRequestType, error) { + vals := map[string]HealthProbeRequestType{ + "get": HealthProbeRequestTypeGET, + "head": HealthProbeRequestTypeHEAD, + "notset": HealthProbeRequestTypeNotSet, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HealthProbeRequestType(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 KeyVaultSigningKeyParametersType string + +const ( + KeyVaultSigningKeyParametersTypeKeyVaultSigningKeyParameters KeyVaultSigningKeyParametersType = "KeyVaultSigningKeyParameters" +) + +func PossibleValuesForKeyVaultSigningKeyParametersType() []string { + return []string{ + string(KeyVaultSigningKeyParametersTypeKeyVaultSigningKeyParameters), + } +} + +func (s *KeyVaultSigningKeyParametersType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyVaultSigningKeyParametersType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseKeyVaultSigningKeyParametersType(input string) (*KeyVaultSigningKeyParametersType, error) { + vals := map[string]KeyVaultSigningKeyParametersType{ + "keyvaultsigningkeyparameters": KeyVaultSigningKeyParametersTypeKeyVaultSigningKeyParameters, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyVaultSigningKeyParametersType(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 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 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 PrivateEndpointStatus string + +const ( + PrivateEndpointStatusApproved PrivateEndpointStatus = "Approved" + PrivateEndpointStatusDisconnected PrivateEndpointStatus = "Disconnected" + PrivateEndpointStatusPending PrivateEndpointStatus = "Pending" + PrivateEndpointStatusRejected PrivateEndpointStatus = "Rejected" + PrivateEndpointStatusTimeout PrivateEndpointStatus = "Timeout" +) + +func PossibleValuesForPrivateEndpointStatus() []string { + return []string{ + string(PrivateEndpointStatusApproved), + string(PrivateEndpointStatusDisconnected), + string(PrivateEndpointStatusPending), + string(PrivateEndpointStatusRejected), + string(PrivateEndpointStatusTimeout), + } +} + +func (s *PrivateEndpointStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointStatus(input string) (*PrivateEndpointStatus, error) { + vals := map[string]PrivateEndpointStatus{ + "approved": PrivateEndpointStatusApproved, + "disconnected": PrivateEndpointStatusDisconnected, + "pending": PrivateEndpointStatusPending, + "rejected": PrivateEndpointStatusRejected, + "timeout": PrivateEndpointStatusTimeout, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointStatus(input) + return &out, nil +} + +type ProbeProtocol string + +const ( + ProbeProtocolHTTP ProbeProtocol = "Http" + ProbeProtocolHTTPS ProbeProtocol = "Https" + ProbeProtocolNotSet ProbeProtocol = "NotSet" +) + +func PossibleValuesForProbeProtocol() []string { + return []string{ + string(ProbeProtocolHTTP), + string(ProbeProtocolHTTPS), + string(ProbeProtocolNotSet), + } +} + +func (s *ProbeProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProbeProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProbeProtocol(input string) (*ProbeProtocol, error) { + vals := map[string]ProbeProtocol{ + "http": ProbeProtocolHTTP, + "https": ProbeProtocolHTTPS, + "notset": ProbeProtocolNotSet, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProbeProtocol(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 QueryStringCachingBehavior string + +const ( + QueryStringCachingBehaviorBypassCaching QueryStringCachingBehavior = "BypassCaching" + QueryStringCachingBehaviorIgnoreQueryString QueryStringCachingBehavior = "IgnoreQueryString" + QueryStringCachingBehaviorNotSet QueryStringCachingBehavior = "NotSet" + QueryStringCachingBehaviorUseQueryString QueryStringCachingBehavior = "UseQueryString" +) + +func PossibleValuesForQueryStringCachingBehavior() []string { + return []string{ + string(QueryStringCachingBehaviorBypassCaching), + string(QueryStringCachingBehaviorIgnoreQueryString), + string(QueryStringCachingBehaviorNotSet), + string(QueryStringCachingBehaviorUseQueryString), + } +} + +func (s *QueryStringCachingBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseQueryStringCachingBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseQueryStringCachingBehavior(input string) (*QueryStringCachingBehavior, error) { + vals := map[string]QueryStringCachingBehavior{ + "bypasscaching": QueryStringCachingBehaviorBypassCaching, + "ignorequerystring": QueryStringCachingBehaviorIgnoreQueryString, + "notset": QueryStringCachingBehaviorNotSet, + "usequerystring": QueryStringCachingBehaviorUseQueryString, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := QueryStringCachingBehavior(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 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 ResponseBasedDetectedErrorTypes string + +const ( + ResponseBasedDetectedErrorTypesNone ResponseBasedDetectedErrorTypes = "None" + ResponseBasedDetectedErrorTypesTcpAndHTTPErrors ResponseBasedDetectedErrorTypes = "TcpAndHttpErrors" + ResponseBasedDetectedErrorTypesTcpErrorsOnly ResponseBasedDetectedErrorTypes = "TcpErrorsOnly" +) + +func PossibleValuesForResponseBasedDetectedErrorTypes() []string { + return []string{ + string(ResponseBasedDetectedErrorTypesNone), + string(ResponseBasedDetectedErrorTypesTcpAndHTTPErrors), + string(ResponseBasedDetectedErrorTypesTcpErrorsOnly), + } +} + +func (s *ResponseBasedDetectedErrorTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResponseBasedDetectedErrorTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResponseBasedDetectedErrorTypes(input string) (*ResponseBasedDetectedErrorTypes, error) { + vals := map[string]ResponseBasedDetectedErrorTypes{ + "none": ResponseBasedDetectedErrorTypesNone, + "tcpandhttperrors": ResponseBasedDetectedErrorTypesTcpAndHTTPErrors, + "tcperrorsonly": ResponseBasedDetectedErrorTypesTcpErrorsOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResponseBasedDetectedErrorTypes(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-02-01/endpoints/id_endpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/id_endpoint.go new file mode 100644 index 000000000000..e2f42915d9a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/id_endpoint.go @@ -0,0 +1,139 @@ +package endpoints + +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(&EndpointId{}) +} + +var _ resourceids.ResourceId = &EndpointId{} + +// EndpointId is a struct representing the Resource ID for a Endpoint +type EndpointId struct { + SubscriptionId string + ResourceGroupName string + ProfileName string + EndpointName string +} + +// NewEndpointID returns a new EndpointId struct +func NewEndpointID(subscriptionId string, resourceGroupName string, profileName string, endpointName string) EndpointId { + return EndpointId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProfileName: profileName, + EndpointName: endpointName, + } +} + +// ParseEndpointID parses 'input' into a EndpointId +func ParseEndpointID(input string) (*EndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(&EndpointId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EndpointId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseEndpointIDInsensitively parses 'input' case-insensitively into a EndpointId +// note: this method should only be used for API response data and not user input +func ParseEndpointIDInsensitively(input string) (*EndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(&EndpointId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EndpointId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EndpointId) 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.EndpointName, ok = input.Parsed["endpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointName", input) + } + + return nil +} + +// ValidateEndpointID checks that 'input' can be parsed as a Endpoint ID +func ValidateEndpointID(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 := ParseEndpointID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Endpoint ID +func (id EndpointId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/endpoints/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName, id.EndpointName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Endpoint ID +func (id EndpointId) 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("staticEndpoints", "endpoints", "endpoints"), + resourceids.UserSpecifiedSegment("endpointName", "endpointName"), + } +} + +// String returns a human-readable description of this Endpoint ID +func (id EndpointId) 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("Endpoint Name: %q", id.EndpointName), + } + return fmt.Sprintf("Endpoint (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/id_profile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/id_profile.go new file mode 100644 index 000000000000..fd055f6da371 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/id_profile.go @@ -0,0 +1,130 @@ +package endpoints + +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/endpoints/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_create.go new file mode 100644 index 000000000000..f5a28f25dece --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_create.go @@ -0,0 +1,76 @@ +package endpoints + +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 *Endpoint +} + +// Create ... +func (c EndpointsClient) Create(ctx context.Context, id EndpointId, input Endpoint) (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 EndpointsClient) CreateThenPoll(ctx context.Context, id EndpointId, input Endpoint) 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/endpoints/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_delete.go new file mode 100644 index 000000000000..466f6bc50652 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_delete.go @@ -0,0 +1,71 @@ +package endpoints + +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 EndpointsClient) Delete(ctx context.Context, id EndpointId) (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 EndpointsClient) DeleteThenPoll(ctx context.Context, id EndpointId) 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/endpoints/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_get.go new file mode 100644 index 000000000000..b81e42bd7da6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_get.go @@ -0,0 +1,53 @@ +package endpoints + +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 *Endpoint +} + +// Get ... +func (c EndpointsClient) Get(ctx context.Context, id EndpointId) (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 Endpoint + 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/endpoints/method_listbyprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_listbyprofile.go new file mode 100644 index 000000000000..4cc86b4aa698 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_listbyprofile.go @@ -0,0 +1,105 @@ +package endpoints + +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 *[]Endpoint +} + +type ListByProfileCompleteResult struct { + LatestHttpResponse *http.Response + Items []Endpoint +} + +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 EndpointsClient) 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/endpoints", 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 *[]Endpoint `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 EndpointsClient) ListByProfileComplete(ctx context.Context, id ProfileId) (ListByProfileCompleteResult, error) { + return c.ListByProfileCompleteMatchingPredicate(ctx, id, EndpointOperationPredicate{}) +} + +// ListByProfileCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c EndpointsClient) ListByProfileCompleteMatchingPredicate(ctx context.Context, id ProfileId, predicate EndpointOperationPredicate) (result ListByProfileCompleteResult, err error) { + items := make([]Endpoint, 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/endpoints/method_listresourceusage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_listresourceusage.go new file mode 100644 index 000000000000..31b7829b9793 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_listresourceusage.go @@ -0,0 +1,105 @@ +package endpoints + +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 EndpointsClient) ListResourceUsage(ctx context.Context, id EndpointId) (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 EndpointsClient) ListResourceUsageComplete(ctx context.Context, id EndpointId) (ListResourceUsageCompleteResult, error) { + return c.ListResourceUsageCompleteMatchingPredicate(ctx, id, ResourceUsageOperationPredicate{}) +} + +// ListResourceUsageCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c EndpointsClient) ListResourceUsageCompleteMatchingPredicate(ctx context.Context, id EndpointId, 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/endpoints/method_loadcontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_loadcontent.go new file mode 100644 index 000000000000..b1ba0411544f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_loadcontent.go @@ -0,0 +1,74 @@ +package endpoints + +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 LoadContentOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// LoadContent ... +func (c EndpointsClient) LoadContent(ctx context.Context, id EndpointId, input LoadParameters) (result LoadContentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/load", 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 +} + +// LoadContentThenPoll performs LoadContent then polls until it's completed +func (c EndpointsClient) LoadContentThenPoll(ctx context.Context, id EndpointId, input LoadParameters) error { + result, err := c.LoadContent(ctx, id, input) + if err != nil { + return fmt.Errorf("performing LoadContent: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after LoadContent: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_purgecontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_purgecontent.go new file mode 100644 index 000000000000..075274be6012 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_purgecontent.go @@ -0,0 +1,74 @@ +package endpoints + +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 PurgeContentOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PurgeContent ... +func (c EndpointsClient) PurgeContent(ctx context.Context, id EndpointId, input PurgeParameters) (result PurgeContentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/purge", 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 +} + +// PurgeContentThenPoll performs PurgeContent then polls until it's completed +func (c EndpointsClient) PurgeContentThenPoll(ctx context.Context, id EndpointId, input PurgeParameters) error { + result, err := c.PurgeContent(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PurgeContent: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PurgeContent: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_start.go new file mode 100644 index 000000000000..c5c1f2c28a65 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_start.go @@ -0,0 +1,71 @@ +package endpoints + +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 StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Endpoint +} + +// Start ... +func (c EndpointsClient) Start(ctx context.Context, id EndpointId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", 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 +} + +// StartThenPoll performs Start then polls until it's completed +func (c EndpointsClient) StartThenPoll(ctx context.Context, id EndpointId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_stop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_stop.go new file mode 100644 index 000000000000..84477fff9dbd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_stop.go @@ -0,0 +1,71 @@ +package endpoints + +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 StopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Endpoint +} + +// Stop ... +func (c EndpointsClient) Stop(ctx context.Context, id EndpointId) (result StopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", 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 +} + +// StopThenPoll performs Stop then polls until it's completed +func (c EndpointsClient) StopThenPoll(ctx context.Context, id EndpointId) error { + result, err := c.Stop(ctx, id) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_update.go new file mode 100644 index 000000000000..b61db980e96b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_update.go @@ -0,0 +1,75 @@ +package endpoints + +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 *Endpoint +} + +// Update ... +func (c EndpointsClient) Update(ctx context.Context, id EndpointId, input EndpointUpdateParameters) (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 EndpointsClient) UpdateThenPoll(ctx context.Context, id EndpointId, input EndpointUpdateParameters) 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/endpoints/method_validatecustomdomain.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_validatecustomdomain.go new file mode 100644 index 000000000000..9d585f35d783 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/method_validatecustomdomain.go @@ -0,0 +1,58 @@ +package endpoints + +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 ValidateCustomDomainOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ValidateCustomDomainOutput +} + +// ValidateCustomDomain ... +func (c EndpointsClient) ValidateCustomDomain(ctx context.Context, id EndpointId, input ValidateCustomDomainInput) (result ValidateCustomDomainOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validateCustomDomain", 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 + } + + var model ValidateCustomDomainOutput + 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/endpoints/model_cacheconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cacheconfiguration.go new file mode 100644 index 000000000000..21f119971ed3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cacheconfiguration.go @@ -0,0 +1,12 @@ +package endpoints + +// 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-02-01/endpoints/model_cacheexpirationactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cacheexpirationactionparameters.go new file mode 100644 index 000000000000..d3a3dc2bc485 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cacheexpirationactionparameters.go @@ -0,0 +1,52 @@ +package endpoints + +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-02-01/endpoints/model_cachekeyquerystringactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cachekeyquerystringactionparameters.go new file mode 100644 index 000000000000..a04c58620d08 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cachekeyquerystringactionparameters.go @@ -0,0 +1,51 @@ +package endpoints + +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-02-01/endpoints/model_clientportmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_clientportmatchconditionparameters.go new file mode 100644 index 000000000000..39bfc0ecd8a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_clientportmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_cookiesmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cookiesmatchconditionparameters.go new file mode 100644 index 000000000000..4ed28470256c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_cookiesmatchconditionparameters.go @@ -0,0 +1,54 @@ +package endpoints + +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-02-01/endpoints/model_deepcreatedcustomdomain.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedcustomdomain.go new file mode 100644 index 000000000000..ec8b3de7b4b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedcustomdomain.go @@ -0,0 +1,9 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeepCreatedCustomDomain struct { + Name string `json:"name"` + Properties *DeepCreatedCustomDomainProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedcustomdomainproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedcustomdomainproperties.go new file mode 100644 index 000000000000..6e671e7d83ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedcustomdomainproperties.go @@ -0,0 +1,9 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeepCreatedCustomDomainProperties struct { + HostName string `json:"hostName"` + ValidationData *string `json:"validationData,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigin.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigin.go new file mode 100644 index 000000000000..690b78c51971 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigin.go @@ -0,0 +1,9 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeepCreatedOrigin struct { + Name string `json:"name"` + Properties *DeepCreatedOriginProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigingroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigingroup.go new file mode 100644 index 000000000000..254badd74b78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigingroup.go @@ -0,0 +1,9 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeepCreatedOriginGroup struct { + Name string `json:"name"` + Properties *DeepCreatedOriginGroupProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigingroupproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigingroupproperties.go new file mode 100644 index 000000000000..f29aff0fea0a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedorigingroupproperties.go @@ -0,0 +1,11 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeepCreatedOriginGroupProperties struct { + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + Origins []ResourceReference `json:"origins"` + ResponseBasedOriginErrorDetectionSettings *ResponseBasedOriginErrorDetectionParameters `json:"responseBasedOriginErrorDetectionSettings,omitempty"` + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int64 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedoriginproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedoriginproperties.go new file mode 100644 index 000000000000..71dbdd39e96f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deepcreatedoriginproperties.go @@ -0,0 +1,19 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeepCreatedOriginProperties struct { + Enabled *bool `json:"enabled,omitempty"` + HTTPPort *int64 `json:"httpPort,omitempty"` + HTTPSPort *int64 `json:"httpsPort,omitempty"` + HostName string `json:"hostName"` + OriginHostHeader *string `json:"originHostHeader,omitempty"` + Priority *int64 `json:"priority,omitempty"` + PrivateEndpointStatus *PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + PrivateLinkResourceId *string `json:"privateLinkResourceId,omitempty"` + Weight *int64 `json:"weight,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrule.go new file mode 100644 index 000000000000..1ff519e4e5d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrule.go @@ -0,0 +1,72 @@ +package endpoints + +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 DeliveryRule struct { + Actions []DeliveryRuleAction `json:"actions"` + Conditions *[]DeliveryRuleCondition `json:"conditions,omitempty"` + Name *string `json:"name,omitempty"` + Order int64 `json:"order"` +} + +var _ json.Unmarshaler = &DeliveryRule{} + +func (s *DeliveryRule) UnmarshalJSON(bytes []byte) error { + var decoded struct { + Name *string `json:"name,omitempty"` + Order int64 `json:"order"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.Name = decoded.Name + s.Order = decoded.Order + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling DeliveryRule 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 'DeliveryRule': %+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 'DeliveryRule': %+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-02-01/endpoints/model_deliveryruleaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleaction.go new file mode 100644 index 000000000000..1f623094311a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleaction.go @@ -0,0 +1,139 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleactionparameters.go new file mode 100644 index 000000000000..e239eb6b31e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleactionparameters.go @@ -0,0 +1,131 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulecacheexpirationaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecacheexpirationaction.go new file mode 100644 index 000000000000..254053e11ecc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecacheexpirationaction.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulecachekeyquerystringaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecachekeyquerystringaction.go new file mode 100644 index 000000000000..c50984c24813 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecachekeyquerystringaction.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleclientportcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleclientportcondition.go new file mode 100644 index 000000000000..d2f98e9677f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleclientportcondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecondition.go new file mode 100644 index 000000000000..bf2d6ee9d794 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecondition.go @@ -0,0 +1,219 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleconditionparameters.go new file mode 100644 index 000000000000..0dfb89f8c210 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleconditionparameters.go @@ -0,0 +1,219 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulecookiescondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecookiescondition.go new file mode 100644 index 000000000000..40445e78379d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulecookiescondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulehostnamecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulehostnamecondition.go new file mode 100644 index 000000000000..f697d6cfe3d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulehostnamecondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulehttpversioncondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulehttpversioncondition.go new file mode 100644 index 000000000000..3f619a9613bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulehttpversioncondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleisdevicecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleisdevicecondition.go new file mode 100644 index 000000000000..d491df211486 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleisdevicecondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulepostargscondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulepostargscondition.go new file mode 100644 index 000000000000..d9405b44ca7b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulepostargscondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulequerystringcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulequerystringcondition.go new file mode 100644 index 000000000000..2e0f6b1b7988 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulequerystringcondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleremoteaddresscondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleremoteaddresscondition.go new file mode 100644 index 000000000000..0f2374f5f2a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleremoteaddresscondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulerequestbodycondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestbodycondition.go new file mode 100644 index 000000000000..1ad88833bf22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestbodycondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulerequestheaderaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestheaderaction.go new file mode 100644 index 000000000000..7432a3b4eea7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestheaderaction.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulerequestheadercondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestheadercondition.go new file mode 100644 index 000000000000..c19f7f765d23 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestheadercondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulerequestmethodcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestmethodcondition.go new file mode 100644 index 000000000000..beae9e17f39e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestmethodcondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulerequestschemecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestschemecondition.go new file mode 100644 index 000000000000..0b59c0fccc96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequestschemecondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulerequesturicondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequesturicondition.go new file mode 100644 index 000000000000..f57742a7df89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerequesturicondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleresponseheaderaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleresponseheaderaction.go new file mode 100644 index 000000000000..fd59a2b461d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleresponseheaderaction.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulerouteconfigurationoverrideaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerouteconfigurationoverrideaction.go new file mode 100644 index 000000000000..58797deab401 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulerouteconfigurationoverrideaction.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleserverportcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleserverportcondition.go new file mode 100644 index 000000000000..7b1c12f5b1ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleserverportcondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulesocketaddrcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulesocketaddrcondition.go new file mode 100644 index 000000000000..73de4ae88f75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulesocketaddrcondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryrulesslprotocolcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulesslprotocolcondition.go new file mode 100644 index 000000000000..072201f5372d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryrulesslprotocolcondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleurlfileextensioncondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleurlfileextensioncondition.go new file mode 100644 index 000000000000..caf12ca2fd79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleurlfileextensioncondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleurlfilenamecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleurlfilenamecondition.go new file mode 100644 index 000000000000..c2c6f61a99df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleurlfilenamecondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_deliveryruleurlpathcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleurlpathcondition.go new file mode 100644 index 000000000000..c67b5fa29ac4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_deliveryruleurlpathcondition.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_endpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpoint.go new file mode 100644 index 000000000000..1367b86ec127 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpoint.go @@ -0,0 +1,18 @@ +package endpoints + +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 Endpoint struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *EndpointProperties `json:"properties,omitempty"` + 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/endpoints/model_endpointproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointproperties.go new file mode 100644 index 000000000000..35d5341712d6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointproperties.go @@ -0,0 +1,27 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointProperties struct { + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + CustomDomains *[]DeepCreatedCustomDomain `json:"customDomains,omitempty"` + DefaultOriginGroup *ResourceReference `json:"defaultOriginGroup,omitempty"` + DeliveryPolicy *EndpointPropertiesUpdateParametersDeliveryPolicy `json:"deliveryPolicy,omitempty"` + GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` + HostName *string `json:"hostName,omitempty"` + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` + IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` + IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` + OptimizationType *OptimizationType `json:"optimizationType,omitempty"` + OriginGroups *[]DeepCreatedOriginGroup `json:"originGroups,omitempty"` + OriginHostHeader *string `json:"originHostHeader,omitempty"` + OriginPath *string `json:"originPath,omitempty"` + Origins []DeepCreatedOrigin `json:"origins"` + ProbePath *string `json:"probePath,omitempty"` + ProvisioningState *EndpointProvisioningState `json:"provisioningState,omitempty"` + QueryStringCachingBehavior *QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + ResourceState *EndpointResourceState `json:"resourceState,omitempty"` + UrlSigningKeys *[]URLSigningKey `json:"urlSigningKeys,omitempty"` + WebApplicationFirewallPolicyLink *EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparameters.go new file mode 100644 index 000000000000..adb1f260474f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparameters.go @@ -0,0 +1,21 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointPropertiesUpdateParameters struct { + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + DefaultOriginGroup *ResourceReference `json:"defaultOriginGroup,omitempty"` + DeliveryPolicy *EndpointPropertiesUpdateParametersDeliveryPolicy `json:"deliveryPolicy,omitempty"` + GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` + IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` + IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` + OptimizationType *OptimizationType `json:"optimizationType,omitempty"` + OriginHostHeader *string `json:"originHostHeader,omitempty"` + OriginPath *string `json:"originPath,omitempty"` + ProbePath *string `json:"probePath,omitempty"` + QueryStringCachingBehavior *QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + UrlSigningKeys *[]URLSigningKey `json:"urlSigningKeys,omitempty"` + WebApplicationFirewallPolicyLink *EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparametersdeliverypolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparametersdeliverypolicy.go new file mode 100644 index 000000000000..fc16bce3fc33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparametersdeliverypolicy.go @@ -0,0 +1,9 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointPropertiesUpdateParametersDeliveryPolicy struct { + Description *string `json:"description,omitempty"` + Rules []DeliveryRule `json:"rules"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparameterswebapplicationfirewallpolicylink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparameterswebapplicationfirewallpolicylink.go new file mode 100644 index 000000000000..334f027af8d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointpropertiesupdateparameterswebapplicationfirewallpolicylink.go @@ -0,0 +1,8 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointupdateparameters.go new file mode 100644 index 000000000000..8e59a3fc5f88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_endpointupdateparameters.go @@ -0,0 +1,9 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointUpdateParameters struct { + Properties *EndpointPropertiesUpdateParameters `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/endpoints/model_geofilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_geofilter.go new file mode 100644 index 000000000000..245420ec6435 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_geofilter.go @@ -0,0 +1,10 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GeoFilter struct { + Action GeoFilterActions `json:"action"` + CountryCodes []string `json:"countryCodes"` + RelativePath string `json:"relativePath"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_headeractionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_headeractionparameters.go new file mode 100644 index 000000000000..3753776b30aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_headeractionparameters.go @@ -0,0 +1,52 @@ +package endpoints + +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-02-01/endpoints/model_healthprobeparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_healthprobeparameters.go new file mode 100644 index 000000000000..f7491e35f6a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_healthprobeparameters.go @@ -0,0 +1,11 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthProbeParameters struct { + ProbeIntervalInSeconds *int64 `json:"probeIntervalInSeconds,omitempty"` + ProbePath *string `json:"probePath,omitempty"` + ProbeProtocol *ProbeProtocol `json:"probeProtocol,omitempty"` + ProbeRequestType *HealthProbeRequestType `json:"probeRequestType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_hostnamematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_hostnamematchconditionparameters.go new file mode 100644 index 000000000000..ab3ac42a66ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_hostnamematchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_httperrorrangeparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_httperrorrangeparameters.go new file mode 100644 index 000000000000..7ee3f694daa1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_httperrorrangeparameters.go @@ -0,0 +1,9 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HTTPErrorRangeParameters struct { + Begin *int64 `json:"begin,omitempty"` + End *int64 `json:"end,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_httpversionmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_httpversionmatchconditionparameters.go new file mode 100644 index 000000000000..3e6ff5da2c45 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_httpversionmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_isdevicematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_isdevicematchconditionparameters.go new file mode 100644 index 000000000000..d5dc64eb8b43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_isdevicematchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_keyvaultsigningkeyparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_keyvaultsigningkeyparameters.go new file mode 100644 index 000000000000..9c7b3e64eb11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_keyvaultsigningkeyparameters.go @@ -0,0 +1,13 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSigningKeyParameters struct { + ResourceGroupName string `json:"resourceGroupName"` + SecretName string `json:"secretName"` + SecretVersion string `json:"secretVersion"` + SubscriptionId string `json:"subscriptionId"` + TypeName KeyVaultSigningKeyParametersType `json:"typeName"` + VaultName string `json:"vaultName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_loadparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_loadparameters.go new file mode 100644 index 000000000000..4ba6766cb34d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_loadparameters.go @@ -0,0 +1,8 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadParameters struct { + ContentPaths []string `json:"contentPaths"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverride.go new file mode 100644 index 000000000000..e01336f64517 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverride.go @@ -0,0 +1,9 @@ +package endpoints + +// 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-02-01/endpoints/model_origingroupoverrideaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverrideaction.go new file mode 100644 index 000000000000..48eb25360ed8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverrideaction.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_origingroupoverrideactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverrideactionparameters.go new file mode 100644 index 000000000000..0a949266e4d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_origingroupoverrideactionparameters.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_postargsmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_postargsmatchconditionparameters.go new file mode 100644 index 000000000000..19dab87e8527 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_postargsmatchconditionparameters.go @@ -0,0 +1,54 @@ +package endpoints + +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-02-01/endpoints/model_purgeparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_purgeparameters.go new file mode 100644 index 000000000000..7df637012d12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_purgeparameters.go @@ -0,0 +1,8 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PurgeParameters struct { + ContentPaths []string `json:"contentPaths"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_querystringmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_querystringmatchconditionparameters.go new file mode 100644 index 000000000000..fc8bf16d2260 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_querystringmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_remoteaddressmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_remoteaddressmatchconditionparameters.go new file mode 100644 index 000000000000..5c923d395004 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_remoteaddressmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_requestbodymatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestbodymatchconditionparameters.go new file mode 100644 index 000000000000..3c56322cee38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestbodymatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_requestheadermatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestheadermatchconditionparameters.go new file mode 100644 index 000000000000..9ab38ac5afb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestheadermatchconditionparameters.go @@ -0,0 +1,54 @@ +package endpoints + +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-02-01/endpoints/model_requestmethodmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestmethodmatchconditionparameters.go new file mode 100644 index 000000000000..d2b7b5f6d62a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestmethodmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_requestschemematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestschemematchconditionparameters.go new file mode 100644 index 000000000000..f90b69b35bfe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requestschemematchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_requesturimatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requesturimatchconditionparameters.go new file mode 100644 index 000000000000..5ddcfe8d72c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_requesturimatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_resourcereference.go new file mode 100644 index 000000000000..d2738a854046 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_resourcereference.go @@ -0,0 +1,8 @@ +package endpoints + +// 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/endpoints/model_resourceusage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_resourceusage.go new file mode 100644 index 000000000000..e9ab54ffd5c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_resourceusage.go @@ -0,0 +1,11 @@ +package endpoints + +// 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/endpoints/model_responsebasedoriginerrordetectionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_responsebasedoriginerrordetectionparameters.go new file mode 100644 index 000000000000..e9d37b8212f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_responsebasedoriginerrordetectionparameters.go @@ -0,0 +1,10 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResponseBasedOriginErrorDetectionParameters struct { + HTTPErrorRanges *[]HTTPErrorRangeParameters `json:"httpErrorRanges,omitempty"` + ResponseBasedDetectedErrorTypes *ResponseBasedDetectedErrorTypes `json:"responseBasedDetectedErrorTypes,omitempty"` + ResponseBasedFailoverThresholdPercentage *int64 `json:"responseBasedFailoverThresholdPercentage,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_routeconfigurationoverrideactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_routeconfigurationoverrideactionparameters.go new file mode 100644 index 000000000000..7bfb2fb6be3a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_routeconfigurationoverrideactionparameters.go @@ -0,0 +1,51 @@ +package endpoints + +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-02-01/endpoints/model_serverportmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_serverportmatchconditionparameters.go new file mode 100644 index 000000000000..27d2be14b5d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_serverportmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_socketaddrmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_socketaddrmatchconditionparameters.go new file mode 100644 index 000000000000..ebc678187973 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_socketaddrmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_sslprotocolmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_sslprotocolmatchconditionparameters.go new file mode 100644 index 000000000000..875a8a68b53b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_sslprotocolmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_urlfileextensionmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlfileextensionmatchconditionparameters.go new file mode 100644 index 000000000000..543a890572f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlfileextensionmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_urlfilenamematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlfilenamematchconditionparameters.go new file mode 100644 index 000000000000..af287a69d2e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlfilenamematchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_urlpathmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlpathmatchconditionparameters.go new file mode 100644 index 000000000000..fc1e2b837d50 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlpathmatchconditionparameters.go @@ -0,0 +1,53 @@ +package endpoints + +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-02-01/endpoints/model_urlredirectaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlredirectaction.go new file mode 100644 index 000000000000..a82af931aaa0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlredirectaction.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_urlredirectactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlredirectactionparameters.go new file mode 100644 index 000000000000..9d30e3ee1d90 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlredirectactionparameters.go @@ -0,0 +1,55 @@ +package endpoints + +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-02-01/endpoints/model_urlrewriteaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlrewriteaction.go new file mode 100644 index 000000000000..f45df93ec320 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlrewriteaction.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_urlrewriteactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlrewriteactionparameters.go new file mode 100644 index 000000000000..dd8bafa33f12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlrewriteactionparameters.go @@ -0,0 +1,52 @@ +package endpoints + +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-02-01/endpoints/model_urlsigningaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningaction.go new file mode 100644 index 000000000000..5bb4b815f27c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningaction.go @@ -0,0 +1,50 @@ +package endpoints + +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-02-01/endpoints/model_urlsigningactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningactionparameters.go new file mode 100644 index 000000000000..2d8b2ce8da70 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningactionparameters.go @@ -0,0 +1,51 @@ +package endpoints + +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-02-01/endpoints/model_urlsigningkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningkey.go new file mode 100644 index 000000000000..7e788a39c7cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningkey.go @@ -0,0 +1,9 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type URLSigningKey struct { + KeyId string `json:"keyId"` + KeySourceParameters KeyVaultSigningKeyParameters `json:"keySourceParameters"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningparamidentifier.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningparamidentifier.go new file mode 100644 index 000000000000..537fae3e438a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_urlsigningparamidentifier.go @@ -0,0 +1,9 @@ +package endpoints + +// 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-02-01/endpoints/model_validatecustomdomaininput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_validatecustomdomaininput.go new file mode 100644 index 000000000000..e143829b2e96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_validatecustomdomaininput.go @@ -0,0 +1,8 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateCustomDomainInput struct { + HostName string `json:"hostName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_validatecustomdomainoutput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_validatecustomdomainoutput.go new file mode 100644 index 000000000000..ca1523061435 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/model_validatecustomdomainoutput.go @@ -0,0 +1,10 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateCustomDomainOutput struct { + CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` + Message *string `json:"message,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/predicates.go new file mode 100644 index 000000000000..bb41ee6d27ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/predicates.go @@ -0,0 +1,55 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p EndpointOperationPredicate) Matches(input Endpoint) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + 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/endpoints/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/version.go new file mode 100644 index 000000000000..8411b754eea6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/endpoints/version.go @@ -0,0 +1,10 @@ +package endpoints + +// 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/endpoints/2024-02-01" +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 208331dec477..5acedf9f501f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -309,6 +309,7 @@ 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/endpoints github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins 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/rules