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 01/17] 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 02/17] 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 03/17] 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 From d12bc09ba97f2feb3a04a785762b8de54ffd5424 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Thu, 30 Jan 2025 03:19:36 -0700 Subject: [PATCH 04/17] Think I have the new polymorphisim figured out here... --- .../cdn/cdn_frontdoor_rule_resource.go | 127 ++++-- .../cdn/cdn_frontdoor_rule_set_data_source.go | 16 +- .../cdn/cdn_frontdoor_rule_set_resource.go | 36 +- .../cdn_frontdoor_rule_set_resource_test.go | 12 +- .../cdn/cdn_frontdoor_shared_schema.go | 2 +- .../delivery_rule_action_discriminator.go | 63 --- .../delivery_rule_condition_discriminator.go | 186 -------- .../cdn_frontdoor_rule_actions.go | 33 +- .../cdn_frontdoor_rule_conditions.go | 415 +++++++----------- .../validate/front_door_validation_helpers.go | 26 +- 10 files changed, 298 insertions(+), 618 deletions(-) delete mode 100644 internal/services/cdn/frontdoordeliveryruleactiondiscriminator/delivery_rule_action_discriminator.go delete mode 100644 internal/services/cdn/frontdoordeliveryruleconditiondiscriminator/delivery_rule_condition_discriminator.go diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource.go b/internal/services/cdn/cdn_frontdoor_rule_resource.go index 50dcd4afa1e2..e5b942e4507f 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource.go @@ -13,7 +13,6 @@ import ( "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" @@ -927,13 +926,10 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition // 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 { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.ClientPort.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleClientPortCondition) - condition := rules.DeliveryRuleClientPortCondition{ - Name: rules.MatchVariableClientPort, - } - - flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorClientPortCondition(deliveryRuleCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorClientPortCondition(condition) if err != nil { return nil, err } @@ -942,7 +938,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleCookiesCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.Cookies.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleCookiesCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorCookiesCondition(condition) if err != nil { return nil, err @@ -952,7 +950,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleHostNameCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.HostName.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleHostNameCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorHostNameCondition(condition) if err != nil { return nil, err @@ -962,16 +962,22 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleHTTPVersionCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.HttpVersion.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleHTTPVersionCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorHttpVersionCondition(condition) if err != nil { return nil, err } + httpVersionCondition = append(httpVersionCondition, flattened) continue + } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleIsDeviceCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.IsDevice.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleIsDeviceCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorIsDeviceCondition(condition) if err != nil { return nil, err @@ -981,7 +987,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRulePostArgsCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.PostArgs.Name { + condition := deliveryRuleCondition.(rules.DeliveryRulePostArgsCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorPostArgsCondition(condition) if err != nil { return nil, err @@ -991,7 +999,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleQueryStringCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.QueryString.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleQueryStringCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorQueryStringCondition(condition) if err != nil { return nil, err @@ -1001,7 +1011,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRemoteAddressCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.RemoteAddress.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleRemoteAddressCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRemoteAddressCondition(condition) if err != nil { return nil, err @@ -1009,9 +1021,12 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition remoteAddressCondition = append(remoteAddressCondition, flattened) continue + } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestBodyCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.RequestBody.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleRequestBodyCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestBodyCondition(condition) if err != nil { return nil, err @@ -1021,7 +1036,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestHeaderCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.RequestHeader.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleRequestHeaderCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestHeaderCondition(condition) if err != nil { return nil, err @@ -1031,7 +1048,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestMethodCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.RequestMethod.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleRequestMethodCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestMethodCondition(condition) if err != nil { return nil, err @@ -1041,7 +1060,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestSchemeCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.RequestScheme.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleRequestSchemeCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestSchemeCondition(condition) if err != nil { return nil, err @@ -1051,7 +1072,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleRequestURICondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.RequestUri.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleRequestUriCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorRequestUriCondition(condition) if err != nil { return nil, err @@ -1061,7 +1084,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleServerPortCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.ServerPort.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleServerPortCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorServerPortCondition(condition) if err != nil { return nil, err @@ -1071,7 +1096,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleSocketAddrCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.SocketAddress.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleSocketAddrCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorSocketAddressCondition(condition) if err != nil { return nil, err @@ -1081,7 +1108,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleSslProtocolCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.SslProtocol.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleSslProtocolCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorSslProtocolCondition(condition) if err != nil { return nil, err @@ -1091,7 +1120,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleURLFileExtensionCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.UrlFileExtension.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleURLFileExtensionCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorUrlFileExtensionCondition(condition) if err != nil { return nil, err @@ -1101,7 +1132,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleURLFileNameCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.UrlFilename.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleURLFileNameCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorUrlFileNameCondition(condition) if err != nil { return nil, err @@ -1111,7 +1144,9 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - if condition, ok := cdnFrontDoorConditionDiscriminator.AsDeliveryRuleURLPathCondition(deliveryRuleCondition); ok { + if deliveryRuleCondition.DeliveryRuleCondition().Name == c.UrlPath.Name { + condition := deliveryRuleCondition.(rules.DeliveryRuleURLPathCondition) + flattened, err := cdnFrontDoorRuleConditions.FlattenFrontdoorUrlPathCondition(condition) if err != nil { return nil, err @@ -1121,7 +1156,7 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition continue } - return nil, fmt.Errorf("unknown BasicDeliveryRuleCondition encountered") + return nil, fmt.Errorf("unknown DeliveryRuleCondition %q encountered", deliveryRuleCondition.DeliveryRuleCondition().Name) } conditions := map[string]interface{}{ @@ -1172,9 +1207,11 @@ func flattenFrontdoorDeliveryRuleActions(input *[]rules.DeliveryRuleAction) ([]i urlRedirectActions := make([]interface{}, 0) urlRewriteActions := make([]interface{}, 0) - for _, item := range *input { - if action, ok := item.AsDeliveryRuleRouteConfigurationOverrideAction(); ok { - flattened, err := cdnFrontDoorRuleActions.FlattenCdnFrontDoorRouteConfigurationOverrideAction(*action) + for _, deliveryRuleAction := range *input { + if deliveryRuleAction.DeliveryRuleAction().Name == a.RouteConfigurationOverride.Name { + action := deliveryRuleAction.(rules.DeliveryRuleRouteConfigurationOverrideAction) + + flattened, err := cdnFrontDoorRuleActions.FlattenCdnFrontDoorRouteConfigurationOverrideAction(action) if err != nil { return nil, fmt.Errorf("'route_configuration_override_action' unable to parse 'cdn_frontdoor_origin_group_id': %+v", err) } @@ -1183,35 +1220,39 @@ func flattenFrontdoorDeliveryRuleActions(input *[]rules.DeliveryRuleAction) ([]i continue } - if action, ok := item.AsDeliveryRuleRequestHeaderAction(); ok { - if action.Parameters == nil { - return nil, fmt.Errorf("'parameters' was nil for Delivery Rule Request Header") - } - flattened := cdnFrontDoorRuleActions.FlattenHeaderActionParameters(action.Parameters) + if deliveryRuleAction.DeliveryRuleAction().Name == a.RequestHeader.Name { + action := deliveryRuleAction.(rules.DeliveryRuleRequestHeaderAction) + + flattened := cdnFrontDoorRuleActions.FlattenRequestHeaderAction(action) requestHeaderActions = append(requestHeaderActions, flattened) continue } - if action, ok := item.AsDeliveryRuleResponseHeaderAction(); ok { - if action.Parameters == nil { - return nil, fmt.Errorf("'parameters' was nil for Delivery Rule Response Header") - } - flattened := cdnFrontDoorRuleActions.FlattenHeaderActionParameters(action.Parameters) + if deliveryRuleAction.DeliveryRuleAction().Name == a.ResponseHeader.Name { + action := deliveryRuleAction.(rules.DeliveryRuleResponseHeaderAction) + + flattened := cdnFrontDoorRuleActions.FlattenResponseHeaderAction(action) responseHeaderActions = append(responseHeaderActions, flattened) continue } - if action, ok := item.AsURLRedirectAction(); ok { - flattened := cdnFrontDoorRuleActions.FlattenCdnFrontDoorUrlRedirectAction(*action) + if deliveryRuleAction.DeliveryRuleAction().Name == a.URLRedirect.Name { + action := deliveryRuleAction.(rules.URLRedirectAction) + + flattened := cdnFrontDoorRuleActions.FlattenCdnFrontDoorUrlRedirectAction(action) urlRedirectActions = append(urlRedirectActions, flattened) continue } - if action, ok := item.AsURLRewriteAction(); ok { - flattened := cdnFrontDoorRuleActions.FlattenCdnFrontDoorUrlRewriteAction(*action) + if deliveryRuleAction.DeliveryRuleAction().Name == a.URLRewrite.Name { + action := deliveryRuleAction.(rules.URLRewriteAction) + + flattened := cdnFrontDoorRuleActions.FlattenCdnFrontDoorUrlRewriteAction(action) urlRewriteActions = append(urlRewriteActions, flattened) continue } + + return nil, fmt.Errorf("unknown DeliveryRuleAction %q encountered", deliveryRuleAction.DeliveryRuleAction().Name) } if len(requestHeaderActions) == 0 && len(responseHeaderActions) == 0 && len(routeConfigOverrideActions) == 0 && len(urlRedirectActions) == 0 && len(urlRewriteActions) == 0 { diff --git a/internal/services/cdn/cdn_frontdoor_rule_set_data_source.go b/internal/services/cdn/cdn_frontdoor_rule_set_data_source.go index 8a549b401d64..f498aa2478da 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_set_data_source.go +++ b/internal/services/cdn/cdn_frontdoor_rule_set_data_source.go @@ -7,13 +7,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "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/rulesets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceCdnFrontDoorRuleSet() *pluginsdk.Resource { @@ -53,10 +54,11 @@ func dataSourceCdnFrontDoorRuleSetRead(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewFrontDoorRuleSetID(subscriptionId, d.Get("resource_group_name").(string), d.Get("profile_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName) + id := rulesets.NewRuleSetID(subscriptionId, d.Get("resource_group_name").(string), d.Get("profile_name").(string), d.Get("name").(string)) + + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) @@ -65,8 +67,8 @@ func dataSourceCdnFrontDoorRuleSetRead(d *pluginsdk.ResourceData, meta interface d.SetId(id.ID()) d.Set("name", id.RuleSetName) d.Set("profile_name", id.ProfileName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("cdn_frontdoor_profile_id", parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID()) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("cdn_frontdoor_profile_id", profiles.NewProfileID(subscriptionId, id.ResourceGroupName, id.ProfileName).ID()) return nil } diff --git a/internal/services/cdn/cdn_frontdoor_rule_set_resource.go b/internal/services/cdn/cdn_frontdoor_rule_set_resource.go index 5831f902ff4e..5443c39031ef 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_set_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_set_resource.go @@ -7,14 +7,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets" "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" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceCdnFrontDoorRuleSet() *pluginsdk.Resource { @@ -30,7 +30,7 @@ func resourceCdnFrontDoorRuleSet() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FrontDoorRuleSetID(id) + _, err := rulesets.ParseRuleSetID(id) return err }), @@ -57,27 +57,27 @@ func resourceCdnFrontDoorRuleSetCreate(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - profile, err := parse.FrontDoorProfileID(d.Get("cdn_frontdoor_profile_id").(string)) + profile, err := profiles.ParseProfileID(d.Get("cdn_frontdoor_profile_id").(string)) if err != nil { return err } // func NewRuleSetID(subscriptionId string, resourceGroupName string, profileName string, ruleSetName string) - id := rulesets.NewRuleSetID(profile.SubscriptionId, profile.ResourceGroup, profile.ProfileName, d.Get("name").(string)) + id := rulesets.NewRuleSetID(profile.SubscriptionId, profile.ResourceGroupName, profile.ProfileName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_cdn_frontdoor_rule_set", id.ID()) } } - if _, err = client.Create(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName); err != nil { + if _, err = client.Create(ctx, id); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -90,14 +90,14 @@ func resourceCdnFrontDoorRuleSetRead(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorRuleSetID(d.Id()) + id, err := rulesets.ParseRuleSetID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -105,7 +105,7 @@ func resourceCdnFrontDoorRuleSetRead(d *pluginsdk.ResourceData, meta interface{} } d.Set("name", id.RuleSetName) - d.Set("cdn_frontdoor_profile_id", parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID()) + d.Set("cdn_frontdoor_profile_id", profiles.NewProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) return nil } @@ -115,19 +115,15 @@ func resourceCdnFrontDoorRuleSetDelete(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FrontDoorRuleSetID(d.Id()) + id, err := rulesets.ParseRuleSetID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName) + 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 } diff --git a/internal/services/cdn/cdn_frontdoor_rule_set_resource_test.go b/internal/services/cdn/cdn_frontdoor_rule_set_resource_test.go index bc36de581c2e..1fe45bc68ade 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_set_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_rule_set_resource_test.go @@ -8,10 +8,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets" "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" ) @@ -61,15 +62,16 @@ func TestAccCdnFrontDoorRuleSet_complete(t *testing.T) { } func (r CdnFrontDoorRuleSetResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.FrontDoorRuleSetID(state.ID) + client := clients.Cdn.FrontDoorRuleSetsClient + + id, err := rulesets.ParseRuleSetID(state.ID) if err != nil { return nil, err } - client := clients.Cdn.FrontDoorRuleSetsClient - resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.RuleSetName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %s: %+v", id, err) diff --git a/internal/services/cdn/cdn_frontdoor_shared_schema.go b/internal/services/cdn/cdn_frontdoor_shared_schema.go index 3b7af1c222c1..5656ffc8ce7a 100644 --- a/internal/services/cdn/cdn_frontdoor_shared_schema.go +++ b/internal/services/cdn/cdn_frontdoor_shared_schema.go @@ -4,7 +4,7 @@ package cdn import ( - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/cdn/frontdoordeliveryruleactiondiscriminator/delivery_rule_action_discriminator.go b/internal/services/cdn/frontdoordeliveryruleactiondiscriminator/delivery_rule_action_discriminator.go deleted file mode 100644 index 65cfaa786064..000000000000 --- a/internal/services/cdn/frontdoordeliveryruleactiondiscriminator/delivery_rule_action_discriminator.go +++ /dev/null @@ -1,63 +0,0 @@ -// 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/frontdoordeliveryruleconditiondiscriminator/delivery_rule_condition_discriminator.go b/internal/services/cdn/frontdoordeliveryruleconditiondiscriminator/delivery_rule_condition_discriminator.go deleted file mode 100644 index 98ed40c1c7ab..000000000000 --- a/internal/services/cdn/frontdoordeliveryruleconditiondiscriminator/delivery_rule_condition_discriminator.go +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -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 - } - - 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 -} - -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/frontdoorruleactions/cdn_frontdoor_rule_actions.go b/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go index 0d8a7c779a84..99c5937e50dd 100644 --- a/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go +++ b/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go @@ -320,18 +320,37 @@ func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[ return &output, nil } -func FlattenHeaderActionParameters(input *rules.HeaderActionParameters) map[string]interface{} { +func FlattenRequestHeaderAction(input rules.DeliveryRuleRequestHeaderAction) map[string]interface{} { action := "" name := "" value := "" - if params := input; params != nil { - action = string(params.HeaderAction) - name = params.HeaderName + params := input.Parameters + action = string(params.HeaderAction) + name = params.HeaderName - if params.Value != nil { - value = *params.Value - } + if params.Value != nil { + value = *params.Value + } + + return map[string]interface{}{ + "header_action": action, + "header_name": name, + "value": value, + } +} + +func FlattenResponseHeaderAction(input rules.DeliveryRuleResponseHeaderAction) map[string]interface{} { + action := "" + name := "" + value := "" + + params := input.Parameters + action = string(params.HeaderAction) + name = params.HeaderName + + if params.Value != nil { + value = *params.Value } return map[string]interface{}{ diff --git a/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go b/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go index b6c08e362ad7..8374423646b4 100644 --- a/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go +++ b/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go @@ -9,7 +9,6 @@ import ( "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" @@ -882,333 +881,237 @@ func ExpandCdnFrontDoorSslProtocolCondition(input []interface{}) (*[]rules.Deliv return &output, nil } -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") - } - +func FlattenFrontdoorRemoteAddressCondition(input rules.DeliveryRuleRemoteAddressCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: nil, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: nil, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorRequestMethodCondition(input rules.DeliveryRuleRequestMethodCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: flattenRequestMethodMatchValues(params.MatchValues), - transforms: nil, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: flattenRequestMethodMatchValues(params.MatchValues), + transforms: nil, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorQueryStringCondition(input rules.DeliveryRuleQueryStringCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorPostArgsCondition(input rules.DeliveryRulePostArgsCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: &normalizedSelector{name: pointer.To("post_args_name"), value: params.Selector}, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: &normalizedSelector{name: pointer.To("post_args_name"), value: params.Selector}, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorRequestUriCondition(input rules.DeliveryRuleRequestUriCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorRequestHeaderCondition(input rules.DeliveryRuleRequestHeaderCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: &normalizedSelector{name: pointer.To("header_name"), value: params.Selector}, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: &normalizedSelector{name: pointer.To("header_name"), value: params.Selector}, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorRequestBodyCondition(input rules.DeliveryRuleRequestBodyCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorRequestSchemeCondition(input rules.DeliveryRuleRequestSchemeCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: flattenRequestSchemeMatchValues(params.MatchValues), - transforms: nil, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: flattenRequestSchemeMatchValues(params.MatchValues), + transforms: nil, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorUrlPathCondition(input rules.DeliveryRuleURLPathCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorUrlFileExtensionCondition(input rules.DeliveryRuleURLFileExtensionCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorUrlFileNameCondition(input rules.DeliveryRuleURLFileNameCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorHttpVersionCondition(input rules.DeliveryRuleHTTPVersionCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: nil, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: nil, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorCookiesCondition(input rules.DeliveryRuleCookiesCondition) (map[string]interface{}, error) { // create a normalized condition stub first with empty values so we can push that to the state file normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - // if this has values override the stub values for the actual values - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: &normalizedSelector{name: pointer.To("cookie_name"), value: params.Selector}, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: &normalizedSelector{name: pointer.To("cookie_name"), value: params.Selector}, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } // flatten the normalized condition regardless if it is a stub or not... return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorIsDeviceCondition(input rules.DeliveryRuleIsDeviceCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: flattenIsDeviceMatchValues(params.MatchValues), - transforms: nil, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: flattenIsDeviceMatchValues(params.MatchValues), + transforms: nil, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorSocketAddressCondition(input rules.DeliveryRuleSocketAddrCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: nil, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: nil, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorClientPortCondition(input rules.DeliveryRuleClientPortCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - params := pointer.From(condition) normalized = normalizedCondition{ selector: nil, operator: string(params.Operator), @@ -1220,69 +1123,51 @@ func FlattenFrontdoorClientPortCondition(input *rules.DeliveryRuleClientPortCond return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorServerPortCondition(input rules.DeliveryRuleServerPortCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: nil, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: nil, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorHostNameCondition(input rules.DeliveryRuleHostNameCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: params.MatchValues, - transforms: params.Transforms, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: params.MatchValues, + transforms: params.Transforms, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -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") - } - +func FlattenFrontdoorSslProtocolCondition(input rules.DeliveryRuleSslProtocolCondition) (map[string]interface{}, error) { normalized := createCdnFrontDoorNormalizedConditionStub() + params := input.Parameters - if params := condition; params != nil { - matchValues := make([]string, 0) - for _, value := range *params.MatchValues { - matchValues = append(matchValues, string(value)) - } + matchValues := make([]string, 0) + for _, value := range *params.MatchValues { + matchValues = append(matchValues, string(value)) + } - normalized = normalizedCondition{ - selector: nil, - operator: string(params.Operator), - negateCondition: params.NegateCondition, - matchValues: &matchValues, - transforms: nil, - } + normalized = normalizedCondition{ + selector: nil, + operator: string(params.Operator), + negateCondition: params.NegateCondition, + matchValues: &matchValues, + transforms: nil, } return flattenCdnFrontDoorNormalizedCondition(normalized), nil diff --git a/internal/services/cdn/validate/front_door_validation_helpers.go b/internal/services/cdn/validate/front_door_validation_helpers.go index 9dbdb4f7ab8d..f05d7d1b4954 100644 --- a/internal/services/cdn/validate/front_door_validation_helpers.go +++ b/internal/services/cdn/validate/front_door_validation_helpers.go @@ -10,7 +10,6 @@ import ( "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) { @@ -89,36 +88,21 @@ func CdnFrontDoorSecretName(i interface{}, k string) (_ []string, errors []error } func CdnFrontDoorActionsBlock(actions []rules.DeliveryRuleAction) error { - routeConfigurationOverride := false - responseHeader := false - requestHeader := false urlRewrite := false urlRedirect := false for _, rule := range actions { - if !routeConfigurationOverride { - _, routeConfigurationOverride = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleRouteConfigurationOverrideAction(rule) + if rule.DeliveryRuleAction().Name == rules.DeliveryRuleActionNameURLRewrite { + urlRewrite = true } - if !responseHeader { - _, responseHeader = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleResponseHeaderAction(rule) - } - - if !requestHeader { - _, requestHeader = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleRequestHeaderAction(rule) - } - - if !urlRewrite { - _, urlRewrite = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleUrlRewriteAction(rule) - } - - if !urlRedirect { - _, urlRedirect = frontdoordeliveryruleactiondiscriminator.AsDeliveryRuleUrlRedirectAction(rule) + if rule.DeliveryRuleAction().Name == rules.DeliveryRuleActionNameURLRedirect { + urlRedirect = true } } if urlRedirect && urlRewrite { - return fmt.Errorf("the %q and the %q are both present in the %q match block", "url_redirect_action", "url_rewrite_action", "actions") + return fmt.Errorf("the %q and the %q are both present in the %q block which is invalid", "url_redirect_action", "url_rewrite_action", "actions") } return nil From e28e399f0165c988325d7449dc1000a25bb2e817 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:52:14 -0700 Subject: [PATCH 05/17] go mod vendor --- .../cdn/2024-09-01/rules/README.md | 99 - .../cdn/2024-09-01/rules/client.go | 26 - .../cdn/2024-09-01/rules/constants.go | 2268 ----------------- .../cdn/2024-09-01/rules/id_rule.go | 148 -- .../cdn/2024-09-01/rules/id_ruleset.go | 139 - .../cdn/2024-09-01/rules/method_create.go | 76 - .../cdn/2024-09-01/rules/method_delete.go | 71 - .../cdn/2024-09-01/rules/method_get.go | 53 - .../2024-09-01/rules/method_listbyruleset.go | 105 - .../cdn/2024-09-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-09-01/rules/model_rule.go | 16 - .../2024-09-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-09-01/rules/predicates.go | 27 - .../cdn/2024-09-01/rules/version.go | 10 - vendor/modules.txt | 1 - 80 files changed, 6848 deletions(-) delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/README.md delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/client.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/constants.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_rule.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_ruleset.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_create.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_listbyruleset.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_update.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheconfiguration.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheexpirationactionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cachekeyquerystringactionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_clientportmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cookiesmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleactionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecacheexpirationaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecachekeyquerystringaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleclientportcondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecookiescondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehostnamecondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehttpversioncondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleisdevicecondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulepostargscondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulequerystringcondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleremoteaddresscondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestbodycondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheaderaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheadercondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestmethodcondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestschemecondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequesturicondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleresponseheaderaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleserverportcondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesocketaddrcondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesslprotocolcondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfileextensioncondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfilenamecondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlpathcondition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_headeractionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_hostnamematchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_httpversionmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_isdevicematchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverride.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideactionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_postargsmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_querystringmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_remoteaddressmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestbodymatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestheadermatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestmethodmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestschemematchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requesturimatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_resourcereference.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_routeconfigurationoverrideactionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_rule.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleproperties.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdateparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdatepropertiesparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_serverportmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_socketaddrmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_sslprotocolmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfileextensionmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfilenamematchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlpathmatchconditionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectactionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteactionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningaction.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningactionparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningparamidentifier.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/predicates.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/version.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/README.md deleted file mode 100644 index c3ceffd5f8d8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules` Documentation - -The `rules` SDK allows for interaction with Azure Resource Manager `cdn` (API Version `2024-09-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules" -``` - - -### Client Initialization - -```go -client := rules.NewRulesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `RulesClient.Create` - -```go -ctx := context.TODO() -id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName", "ruleName") - -payload := rules.Rule{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `RulesClient.Delete` - -```go -ctx := context.TODO() -id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName", "ruleName") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `RulesClient.Get` - -```go -ctx := context.TODO() -id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName", "ruleName") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `RulesClient.ListByRuleSet` - -```go -ctx := context.TODO() -id := rules.NewRuleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName") - -// alternatively `client.ListByRuleSet(ctx, id)` can be used to do batched pagination -items, err := client.ListByRuleSetComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `RulesClient.Update` - -```go -ctx := context.TODO() -id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileName", "ruleSetName", "ruleName") - -payload := rules.RuleUpdateParameters{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/client.go deleted file mode 100644 index ee5a5154cef5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package rules - -import ( - "fmt" - - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RulesClient struct { - Client *resourcemanager.Client -} - -func NewRulesClientWithBaseURI(sdkApi sdkEnv.Api) (*RulesClient, error) { - client, err := resourcemanager.NewClient(sdkApi, "rules", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating RulesClient: %+v", err) - } - - return &RulesClient{ - Client: client, - }, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/constants.go deleted file mode 100644 index 6fb915180b59..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/constants.go +++ /dev/null @@ -1,2268 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AfdProvisioningState string - -const ( - AfdProvisioningStateCreating AfdProvisioningState = "Creating" - AfdProvisioningStateDeleting AfdProvisioningState = "Deleting" - AfdProvisioningStateFailed AfdProvisioningState = "Failed" - AfdProvisioningStateSucceeded AfdProvisioningState = "Succeeded" - AfdProvisioningStateUpdating AfdProvisioningState = "Updating" -) - -func PossibleValuesForAfdProvisioningState() []string { - return []string{ - string(AfdProvisioningStateCreating), - string(AfdProvisioningStateDeleting), - string(AfdProvisioningStateFailed), - string(AfdProvisioningStateSucceeded), - string(AfdProvisioningStateUpdating), - } -} - -func (s *AfdProvisioningState) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAfdProvisioningState(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAfdProvisioningState(input string) (*AfdProvisioningState, error) { - vals := map[string]AfdProvisioningState{ - "creating": AfdProvisioningStateCreating, - "deleting": AfdProvisioningStateDeleting, - "failed": AfdProvisioningStateFailed, - "succeeded": AfdProvisioningStateSucceeded, - "updating": AfdProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AfdProvisioningState(input) - return &out, nil -} - -type Algorithm string - -const ( - AlgorithmSHATwoFiveSix Algorithm = "SHA256" -) - -func PossibleValuesForAlgorithm() []string { - return []string{ - string(AlgorithmSHATwoFiveSix), - } -} - -func (s *Algorithm) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAlgorithm(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAlgorithm(input string) (*Algorithm, error) { - vals := map[string]Algorithm{ - "sha256": AlgorithmSHATwoFiveSix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Algorithm(input) - return &out, nil -} - -type CacheBehavior string - -const ( - CacheBehaviorBypassCache CacheBehavior = "BypassCache" - CacheBehaviorOverride CacheBehavior = "Override" - CacheBehaviorSetIfMissing CacheBehavior = "SetIfMissing" -) - -func PossibleValuesForCacheBehavior() []string { - return []string{ - string(CacheBehaviorBypassCache), - string(CacheBehaviorOverride), - string(CacheBehaviorSetIfMissing), - } -} - -func (s *CacheBehavior) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCacheBehavior(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCacheBehavior(input string) (*CacheBehavior, error) { - vals := map[string]CacheBehavior{ - "bypasscache": CacheBehaviorBypassCache, - "override": CacheBehaviorOverride, - "setifmissing": CacheBehaviorSetIfMissing, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CacheBehavior(input) - return &out, nil -} - -type CacheType string - -const ( - CacheTypeAll CacheType = "All" -) - -func PossibleValuesForCacheType() []string { - return []string{ - string(CacheTypeAll), - } -} - -func (s *CacheType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCacheType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCacheType(input string) (*CacheType, error) { - vals := map[string]CacheType{ - "all": CacheTypeAll, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CacheType(input) - return &out, nil -} - -type ClientPortOperator string - -const ( - ClientPortOperatorAny ClientPortOperator = "Any" - ClientPortOperatorBeginsWith ClientPortOperator = "BeginsWith" - ClientPortOperatorContains ClientPortOperator = "Contains" - ClientPortOperatorEndsWith ClientPortOperator = "EndsWith" - ClientPortOperatorEqual ClientPortOperator = "Equal" - ClientPortOperatorGreaterThan ClientPortOperator = "GreaterThan" - ClientPortOperatorGreaterThanOrEqual ClientPortOperator = "GreaterThanOrEqual" - ClientPortOperatorLessThan ClientPortOperator = "LessThan" - ClientPortOperatorLessThanOrEqual ClientPortOperator = "LessThanOrEqual" - ClientPortOperatorRegEx ClientPortOperator = "RegEx" -) - -func PossibleValuesForClientPortOperator() []string { - return []string{ - string(ClientPortOperatorAny), - string(ClientPortOperatorBeginsWith), - string(ClientPortOperatorContains), - string(ClientPortOperatorEndsWith), - string(ClientPortOperatorEqual), - string(ClientPortOperatorGreaterThan), - string(ClientPortOperatorGreaterThanOrEqual), - string(ClientPortOperatorLessThan), - string(ClientPortOperatorLessThanOrEqual), - string(ClientPortOperatorRegEx), - } -} - -func (s *ClientPortOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseClientPortOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseClientPortOperator(input string) (*ClientPortOperator, error) { - vals := map[string]ClientPortOperator{ - "any": ClientPortOperatorAny, - "beginswith": ClientPortOperatorBeginsWith, - "contains": ClientPortOperatorContains, - "endswith": ClientPortOperatorEndsWith, - "equal": ClientPortOperatorEqual, - "greaterthan": ClientPortOperatorGreaterThan, - "greaterthanorequal": ClientPortOperatorGreaterThanOrEqual, - "lessthan": ClientPortOperatorLessThan, - "lessthanorequal": ClientPortOperatorLessThanOrEqual, - "regex": ClientPortOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClientPortOperator(input) - return &out, nil -} - -type CookiesOperator string - -const ( - CookiesOperatorAny CookiesOperator = "Any" - CookiesOperatorBeginsWith CookiesOperator = "BeginsWith" - CookiesOperatorContains CookiesOperator = "Contains" - CookiesOperatorEndsWith CookiesOperator = "EndsWith" - CookiesOperatorEqual CookiesOperator = "Equal" - CookiesOperatorGreaterThan CookiesOperator = "GreaterThan" - CookiesOperatorGreaterThanOrEqual CookiesOperator = "GreaterThanOrEqual" - CookiesOperatorLessThan CookiesOperator = "LessThan" - CookiesOperatorLessThanOrEqual CookiesOperator = "LessThanOrEqual" - CookiesOperatorRegEx CookiesOperator = "RegEx" -) - -func PossibleValuesForCookiesOperator() []string { - return []string{ - string(CookiesOperatorAny), - string(CookiesOperatorBeginsWith), - string(CookiesOperatorContains), - string(CookiesOperatorEndsWith), - string(CookiesOperatorEqual), - string(CookiesOperatorGreaterThan), - string(CookiesOperatorGreaterThanOrEqual), - string(CookiesOperatorLessThan), - string(CookiesOperatorLessThanOrEqual), - string(CookiesOperatorRegEx), - } -} - -func (s *CookiesOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCookiesOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCookiesOperator(input string) (*CookiesOperator, error) { - vals := map[string]CookiesOperator{ - "any": CookiesOperatorAny, - "beginswith": CookiesOperatorBeginsWith, - "contains": CookiesOperatorContains, - "endswith": CookiesOperatorEndsWith, - "equal": CookiesOperatorEqual, - "greaterthan": CookiesOperatorGreaterThan, - "greaterthanorequal": CookiesOperatorGreaterThanOrEqual, - "lessthan": CookiesOperatorLessThan, - "lessthanorequal": CookiesOperatorLessThanOrEqual, - "regex": CookiesOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CookiesOperator(input) - return &out, nil -} - -type DeliveryRuleActionName string - -const ( - DeliveryRuleActionNameCacheExpiration DeliveryRuleActionName = "CacheExpiration" - DeliveryRuleActionNameCacheKeyQueryString DeliveryRuleActionName = "CacheKeyQueryString" - DeliveryRuleActionNameModifyRequestHeader DeliveryRuleActionName = "ModifyRequestHeader" - DeliveryRuleActionNameModifyResponseHeader DeliveryRuleActionName = "ModifyResponseHeader" - DeliveryRuleActionNameOriginGroupOverride DeliveryRuleActionName = "OriginGroupOverride" - DeliveryRuleActionNameRouteConfigurationOverride DeliveryRuleActionName = "RouteConfigurationOverride" - DeliveryRuleActionNameURLRedirect DeliveryRuleActionName = "UrlRedirect" - DeliveryRuleActionNameURLRewrite DeliveryRuleActionName = "UrlRewrite" - DeliveryRuleActionNameURLSigning DeliveryRuleActionName = "UrlSigning" -) - -func PossibleValuesForDeliveryRuleActionName() []string { - return []string{ - string(DeliveryRuleActionNameCacheExpiration), - string(DeliveryRuleActionNameCacheKeyQueryString), - string(DeliveryRuleActionNameModifyRequestHeader), - string(DeliveryRuleActionNameModifyResponseHeader), - string(DeliveryRuleActionNameOriginGroupOverride), - string(DeliveryRuleActionNameRouteConfigurationOverride), - string(DeliveryRuleActionNameURLRedirect), - string(DeliveryRuleActionNameURLRewrite), - string(DeliveryRuleActionNameURLSigning), - } -} - -func (s *DeliveryRuleActionName) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseDeliveryRuleActionName(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseDeliveryRuleActionName(input string) (*DeliveryRuleActionName, error) { - vals := map[string]DeliveryRuleActionName{ - "cacheexpiration": DeliveryRuleActionNameCacheExpiration, - "cachekeyquerystring": DeliveryRuleActionNameCacheKeyQueryString, - "modifyrequestheader": DeliveryRuleActionNameModifyRequestHeader, - "modifyresponseheader": DeliveryRuleActionNameModifyResponseHeader, - "origingroupoverride": DeliveryRuleActionNameOriginGroupOverride, - "routeconfigurationoverride": DeliveryRuleActionNameRouteConfigurationOverride, - "urlredirect": DeliveryRuleActionNameURLRedirect, - "urlrewrite": DeliveryRuleActionNameURLRewrite, - "urlsigning": DeliveryRuleActionNameURLSigning, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DeliveryRuleActionName(input) - return &out, nil -} - -type DeliveryRuleActionParametersType string - -const ( - DeliveryRuleActionParametersTypeDeliveryRuleCacheExpirationActionParameters DeliveryRuleActionParametersType = "DeliveryRuleCacheExpirationActionParameters" - DeliveryRuleActionParametersTypeDeliveryRuleCacheKeyQueryStringBehaviorActionParameters DeliveryRuleActionParametersType = "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" - DeliveryRuleActionParametersTypeDeliveryRuleHeaderActionParameters DeliveryRuleActionParametersType = "DeliveryRuleHeaderActionParameters" - DeliveryRuleActionParametersTypeDeliveryRuleOriginGroupOverrideActionParameters DeliveryRuleActionParametersType = "DeliveryRuleOriginGroupOverrideActionParameters" - DeliveryRuleActionParametersTypeDeliveryRuleRouteConfigurationOverrideActionParameters DeliveryRuleActionParametersType = "DeliveryRuleRouteConfigurationOverrideActionParameters" - DeliveryRuleActionParametersTypeDeliveryRuleURLRedirectActionParameters DeliveryRuleActionParametersType = "DeliveryRuleUrlRedirectActionParameters" - DeliveryRuleActionParametersTypeDeliveryRuleURLRewriteActionParameters DeliveryRuleActionParametersType = "DeliveryRuleUrlRewriteActionParameters" - DeliveryRuleActionParametersTypeDeliveryRuleURLSigningActionParameters DeliveryRuleActionParametersType = "DeliveryRuleUrlSigningActionParameters" -) - -func PossibleValuesForDeliveryRuleActionParametersType() []string { - return []string{ - string(DeliveryRuleActionParametersTypeDeliveryRuleCacheExpirationActionParameters), - string(DeliveryRuleActionParametersTypeDeliveryRuleCacheKeyQueryStringBehaviorActionParameters), - string(DeliveryRuleActionParametersTypeDeliveryRuleHeaderActionParameters), - string(DeliveryRuleActionParametersTypeDeliveryRuleOriginGroupOverrideActionParameters), - string(DeliveryRuleActionParametersTypeDeliveryRuleRouteConfigurationOverrideActionParameters), - string(DeliveryRuleActionParametersTypeDeliveryRuleURLRedirectActionParameters), - string(DeliveryRuleActionParametersTypeDeliveryRuleURLRewriteActionParameters), - string(DeliveryRuleActionParametersTypeDeliveryRuleURLSigningActionParameters), - } -} - -func (s *DeliveryRuleActionParametersType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseDeliveryRuleActionParametersType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseDeliveryRuleActionParametersType(input string) (*DeliveryRuleActionParametersType, error) { - vals := map[string]DeliveryRuleActionParametersType{ - "deliveryrulecacheexpirationactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleCacheExpirationActionParameters, - "deliveryrulecachekeyquerystringbehavioractionparameters": DeliveryRuleActionParametersTypeDeliveryRuleCacheKeyQueryStringBehaviorActionParameters, - "deliveryruleheaderactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleHeaderActionParameters, - "deliveryruleorigingroupoverrideactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleOriginGroupOverrideActionParameters, - "deliveryrulerouteconfigurationoverrideactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleRouteConfigurationOverrideActionParameters, - "deliveryruleurlredirectactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleURLRedirectActionParameters, - "deliveryruleurlrewriteactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleURLRewriteActionParameters, - "deliveryruleurlsigningactionparameters": DeliveryRuleActionParametersTypeDeliveryRuleURLSigningActionParameters, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DeliveryRuleActionParametersType(input) - return &out, nil -} - -type DeliveryRuleConditionParametersType string - -const ( - DeliveryRuleConditionParametersTypeDeliveryRuleClientPortConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleClientPortConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleCookiesConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleCookiesConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleHTTPVersionConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleHttpVersionConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleHostNameConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleHostNameConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleIsDeviceConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRulePostArgsConditionParameters DeliveryRuleConditionParametersType = "DeliveryRulePostArgsConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleQueryStringConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleQueryStringConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleRemoteAddressConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRemoteAddressConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleRequestBodyConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestBodyConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleRequestHeaderConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestHeaderConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestMethodConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleRequestSchemeConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestSchemeConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleRequestUriConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleRequestUriConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleServerPortConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleServerPortConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleSocketAddrConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleSocketAddrConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleSslProtocolConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleSslProtocolConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleUrlFileExtensionMatchConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleURLFilenameConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleUrlFilenameConditionParameters" - DeliveryRuleConditionParametersTypeDeliveryRuleURLPathMatchConditionParameters DeliveryRuleConditionParametersType = "DeliveryRuleUrlPathMatchConditionParameters" -) - -func PossibleValuesForDeliveryRuleConditionParametersType() []string { - return []string{ - string(DeliveryRuleConditionParametersTypeDeliveryRuleClientPortConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleCookiesConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleHTTPVersionConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleHostNameConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRulePostArgsConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleQueryStringConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleRemoteAddressConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestBodyConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestHeaderConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestSchemeConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleRequestUriConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleServerPortConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleSocketAddrConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleSslProtocolConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleURLFilenameConditionParameters), - string(DeliveryRuleConditionParametersTypeDeliveryRuleURLPathMatchConditionParameters), - } -} - -func (s *DeliveryRuleConditionParametersType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseDeliveryRuleConditionParametersType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseDeliveryRuleConditionParametersType(input string) (*DeliveryRuleConditionParametersType, error) { - vals := map[string]DeliveryRuleConditionParametersType{ - "deliveryruleclientportconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleClientPortConditionParameters, - "deliveryrulecookiesconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleCookiesConditionParameters, - "deliveryrulehttpversionconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleHTTPVersionConditionParameters, - "deliveryrulehostnameconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleHostNameConditionParameters, - "deliveryruleisdeviceconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleIsDeviceConditionParameters, - "deliveryrulepostargsconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRulePostArgsConditionParameters, - "deliveryrulequerystringconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleQueryStringConditionParameters, - "deliveryruleremoteaddressconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRemoteAddressConditionParameters, - "deliveryrulerequestbodyconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestBodyConditionParameters, - "deliveryrulerequestheaderconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestHeaderConditionParameters, - "deliveryrulerequestmethodconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestMethodConditionParameters, - "deliveryrulerequestschemeconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestSchemeConditionParameters, - "deliveryrulerequesturiconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleRequestUriConditionParameters, - "deliveryruleserverportconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleServerPortConditionParameters, - "deliveryrulesocketaddrconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleSocketAddrConditionParameters, - "deliveryrulesslprotocolconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleSslProtocolConditionParameters, - "deliveryruleurlfileextensionmatchconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleURLFileExtensionMatchConditionParameters, - "deliveryruleurlfilenameconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleURLFilenameConditionParameters, - "deliveryruleurlpathmatchconditionparameters": DeliveryRuleConditionParametersTypeDeliveryRuleURLPathMatchConditionParameters, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DeliveryRuleConditionParametersType(input) - return &out, nil -} - -type DeploymentStatus string - -const ( - DeploymentStatusFailed DeploymentStatus = "Failed" - DeploymentStatusInProgress DeploymentStatus = "InProgress" - DeploymentStatusNotStarted DeploymentStatus = "NotStarted" - DeploymentStatusSucceeded DeploymentStatus = "Succeeded" -) - -func PossibleValuesForDeploymentStatus() []string { - return []string{ - string(DeploymentStatusFailed), - string(DeploymentStatusInProgress), - string(DeploymentStatusNotStarted), - string(DeploymentStatusSucceeded), - } -} - -func (s *DeploymentStatus) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseDeploymentStatus(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseDeploymentStatus(input string) (*DeploymentStatus, error) { - vals := map[string]DeploymentStatus{ - "failed": DeploymentStatusFailed, - "inprogress": DeploymentStatusInProgress, - "notstarted": DeploymentStatusNotStarted, - "succeeded": DeploymentStatusSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DeploymentStatus(input) - return &out, nil -} - -type DestinationProtocol string - -const ( - DestinationProtocolHTTP DestinationProtocol = "Http" - DestinationProtocolHTTPS DestinationProtocol = "Https" - DestinationProtocolMatchRequest DestinationProtocol = "MatchRequest" -) - -func PossibleValuesForDestinationProtocol() []string { - return []string{ - string(DestinationProtocolHTTP), - string(DestinationProtocolHTTPS), - string(DestinationProtocolMatchRequest), - } -} - -func (s *DestinationProtocol) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseDestinationProtocol(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseDestinationProtocol(input string) (*DestinationProtocol, error) { - vals := map[string]DestinationProtocol{ - "http": DestinationProtocolHTTP, - "https": DestinationProtocolHTTPS, - "matchrequest": DestinationProtocolMatchRequest, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DestinationProtocol(input) - return &out, nil -} - -type ForwardingProtocol string - -const ( - ForwardingProtocolHTTPOnly ForwardingProtocol = "HttpOnly" - ForwardingProtocolHTTPSOnly ForwardingProtocol = "HttpsOnly" - ForwardingProtocolMatchRequest ForwardingProtocol = "MatchRequest" -) - -func PossibleValuesForForwardingProtocol() []string { - return []string{ - string(ForwardingProtocolHTTPOnly), - string(ForwardingProtocolHTTPSOnly), - string(ForwardingProtocolMatchRequest), - } -} - -func (s *ForwardingProtocol) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseForwardingProtocol(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseForwardingProtocol(input string) (*ForwardingProtocol, error) { - vals := map[string]ForwardingProtocol{ - "httponly": ForwardingProtocolHTTPOnly, - "httpsonly": ForwardingProtocolHTTPSOnly, - "matchrequest": ForwardingProtocolMatchRequest, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ForwardingProtocol(input) - return &out, nil -} - -type HTTPVersionOperator string - -const ( - HTTPVersionOperatorEqual HTTPVersionOperator = "Equal" -) - -func PossibleValuesForHTTPVersionOperator() []string { - return []string{ - string(HTTPVersionOperatorEqual), - } -} - -func (s *HTTPVersionOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseHTTPVersionOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseHTTPVersionOperator(input string) (*HTTPVersionOperator, error) { - vals := map[string]HTTPVersionOperator{ - "equal": HTTPVersionOperatorEqual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := HTTPVersionOperator(input) - return &out, nil -} - -type HeaderAction string - -const ( - HeaderActionAppend HeaderAction = "Append" - HeaderActionDelete HeaderAction = "Delete" - HeaderActionOverwrite HeaderAction = "Overwrite" -) - -func PossibleValuesForHeaderAction() []string { - return []string{ - string(HeaderActionAppend), - string(HeaderActionDelete), - string(HeaderActionOverwrite), - } -} - -func (s *HeaderAction) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseHeaderAction(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseHeaderAction(input string) (*HeaderAction, error) { - vals := map[string]HeaderAction{ - "append": HeaderActionAppend, - "delete": HeaderActionDelete, - "overwrite": HeaderActionOverwrite, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := HeaderAction(input) - return &out, nil -} - -type HostNameOperator string - -const ( - HostNameOperatorAny HostNameOperator = "Any" - HostNameOperatorBeginsWith HostNameOperator = "BeginsWith" - HostNameOperatorContains HostNameOperator = "Contains" - HostNameOperatorEndsWith HostNameOperator = "EndsWith" - HostNameOperatorEqual HostNameOperator = "Equal" - HostNameOperatorGreaterThan HostNameOperator = "GreaterThan" - HostNameOperatorGreaterThanOrEqual HostNameOperator = "GreaterThanOrEqual" - HostNameOperatorLessThan HostNameOperator = "LessThan" - HostNameOperatorLessThanOrEqual HostNameOperator = "LessThanOrEqual" - HostNameOperatorRegEx HostNameOperator = "RegEx" -) - -func PossibleValuesForHostNameOperator() []string { - return []string{ - string(HostNameOperatorAny), - string(HostNameOperatorBeginsWith), - string(HostNameOperatorContains), - string(HostNameOperatorEndsWith), - string(HostNameOperatorEqual), - string(HostNameOperatorGreaterThan), - string(HostNameOperatorGreaterThanOrEqual), - string(HostNameOperatorLessThan), - string(HostNameOperatorLessThanOrEqual), - string(HostNameOperatorRegEx), - } -} - -func (s *HostNameOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseHostNameOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseHostNameOperator(input string) (*HostNameOperator, error) { - vals := map[string]HostNameOperator{ - "any": HostNameOperatorAny, - "beginswith": HostNameOperatorBeginsWith, - "contains": HostNameOperatorContains, - "endswith": HostNameOperatorEndsWith, - "equal": HostNameOperatorEqual, - "greaterthan": HostNameOperatorGreaterThan, - "greaterthanorequal": HostNameOperatorGreaterThanOrEqual, - "lessthan": HostNameOperatorLessThan, - "lessthanorequal": HostNameOperatorLessThanOrEqual, - "regex": HostNameOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := HostNameOperator(input) - return &out, nil -} - -type IsDeviceMatchValue string - -const ( - IsDeviceMatchValueDesktop IsDeviceMatchValue = "Desktop" - IsDeviceMatchValueMobile IsDeviceMatchValue = "Mobile" -) - -func PossibleValuesForIsDeviceMatchValue() []string { - return []string{ - string(IsDeviceMatchValueDesktop), - string(IsDeviceMatchValueMobile), - } -} - -func (s *IsDeviceMatchValue) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseIsDeviceMatchValue(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseIsDeviceMatchValue(input string) (*IsDeviceMatchValue, error) { - vals := map[string]IsDeviceMatchValue{ - "desktop": IsDeviceMatchValueDesktop, - "mobile": IsDeviceMatchValueMobile, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := IsDeviceMatchValue(input) - return &out, nil -} - -type IsDeviceOperator string - -const ( - IsDeviceOperatorEqual IsDeviceOperator = "Equal" -) - -func PossibleValuesForIsDeviceOperator() []string { - return []string{ - string(IsDeviceOperatorEqual), - } -} - -func (s *IsDeviceOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseIsDeviceOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseIsDeviceOperator(input string) (*IsDeviceOperator, error) { - vals := map[string]IsDeviceOperator{ - "equal": IsDeviceOperatorEqual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := IsDeviceOperator(input) - return &out, nil -} - -type MatchProcessingBehavior string - -const ( - MatchProcessingBehaviorContinue MatchProcessingBehavior = "Continue" - MatchProcessingBehaviorStop MatchProcessingBehavior = "Stop" -) - -func PossibleValuesForMatchProcessingBehavior() []string { - return []string{ - string(MatchProcessingBehaviorContinue), - string(MatchProcessingBehaviorStop), - } -} - -func (s *MatchProcessingBehavior) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseMatchProcessingBehavior(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseMatchProcessingBehavior(input string) (*MatchProcessingBehavior, error) { - vals := map[string]MatchProcessingBehavior{ - "continue": MatchProcessingBehaviorContinue, - "stop": MatchProcessingBehaviorStop, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := MatchProcessingBehavior(input) - return &out, nil -} - -type MatchVariable string - -const ( - MatchVariableClientPort MatchVariable = "ClientPort" - MatchVariableCookies MatchVariable = "Cookies" - MatchVariableHTTPVersion MatchVariable = "HttpVersion" - MatchVariableHostName MatchVariable = "HostName" - MatchVariableIsDevice MatchVariable = "IsDevice" - MatchVariablePostArgs MatchVariable = "PostArgs" - MatchVariableQueryString MatchVariable = "QueryString" - MatchVariableRemoteAddress MatchVariable = "RemoteAddress" - MatchVariableRequestBody MatchVariable = "RequestBody" - MatchVariableRequestHeader MatchVariable = "RequestHeader" - MatchVariableRequestMethod MatchVariable = "RequestMethod" - MatchVariableRequestScheme MatchVariable = "RequestScheme" - MatchVariableRequestUri MatchVariable = "RequestUri" - MatchVariableServerPort MatchVariable = "ServerPort" - MatchVariableSocketAddr MatchVariable = "SocketAddr" - MatchVariableSslProtocol MatchVariable = "SslProtocol" - MatchVariableURLFileExtension MatchVariable = "UrlFileExtension" - MatchVariableURLFileName MatchVariable = "UrlFileName" - MatchVariableURLPath MatchVariable = "UrlPath" -) - -func PossibleValuesForMatchVariable() []string { - return []string{ - string(MatchVariableClientPort), - string(MatchVariableCookies), - string(MatchVariableHTTPVersion), - string(MatchVariableHostName), - string(MatchVariableIsDevice), - string(MatchVariablePostArgs), - string(MatchVariableQueryString), - string(MatchVariableRemoteAddress), - string(MatchVariableRequestBody), - string(MatchVariableRequestHeader), - string(MatchVariableRequestMethod), - string(MatchVariableRequestScheme), - string(MatchVariableRequestUri), - string(MatchVariableServerPort), - string(MatchVariableSocketAddr), - string(MatchVariableSslProtocol), - string(MatchVariableURLFileExtension), - string(MatchVariableURLFileName), - string(MatchVariableURLPath), - } -} - -func (s *MatchVariable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseMatchVariable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseMatchVariable(input string) (*MatchVariable, error) { - vals := map[string]MatchVariable{ - "clientport": MatchVariableClientPort, - "cookies": MatchVariableCookies, - "httpversion": MatchVariableHTTPVersion, - "hostname": MatchVariableHostName, - "isdevice": MatchVariableIsDevice, - "postargs": MatchVariablePostArgs, - "querystring": MatchVariableQueryString, - "remoteaddress": MatchVariableRemoteAddress, - "requestbody": MatchVariableRequestBody, - "requestheader": MatchVariableRequestHeader, - "requestmethod": MatchVariableRequestMethod, - "requestscheme": MatchVariableRequestScheme, - "requesturi": MatchVariableRequestUri, - "serverport": MatchVariableServerPort, - "socketaddr": MatchVariableSocketAddr, - "sslprotocol": MatchVariableSslProtocol, - "urlfileextension": MatchVariableURLFileExtension, - "urlfilename": MatchVariableURLFileName, - "urlpath": MatchVariableURLPath, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := MatchVariable(input) - return &out, nil -} - -type Operator string - -const ( - OperatorEqual Operator = "Equal" -) - -func PossibleValuesForOperator() []string { - return []string{ - string(OperatorEqual), - } -} - -func (s *Operator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseOperator(input string) (*Operator, error) { - vals := map[string]Operator{ - "equal": OperatorEqual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Operator(input) - return &out, nil -} - -type ParamIndicator string - -const ( - ParamIndicatorExpires ParamIndicator = "Expires" - ParamIndicatorKeyId ParamIndicator = "KeyId" - ParamIndicatorSignature ParamIndicator = "Signature" -) - -func PossibleValuesForParamIndicator() []string { - return []string{ - string(ParamIndicatorExpires), - string(ParamIndicatorKeyId), - string(ParamIndicatorSignature), - } -} - -func (s *ParamIndicator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseParamIndicator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseParamIndicator(input string) (*ParamIndicator, error) { - vals := map[string]ParamIndicator{ - "expires": ParamIndicatorExpires, - "keyid": ParamIndicatorKeyId, - "signature": ParamIndicatorSignature, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ParamIndicator(input) - return &out, nil -} - -type PostArgsOperator string - -const ( - PostArgsOperatorAny PostArgsOperator = "Any" - PostArgsOperatorBeginsWith PostArgsOperator = "BeginsWith" - PostArgsOperatorContains PostArgsOperator = "Contains" - PostArgsOperatorEndsWith PostArgsOperator = "EndsWith" - PostArgsOperatorEqual PostArgsOperator = "Equal" - PostArgsOperatorGreaterThan PostArgsOperator = "GreaterThan" - PostArgsOperatorGreaterThanOrEqual PostArgsOperator = "GreaterThanOrEqual" - PostArgsOperatorLessThan PostArgsOperator = "LessThan" - PostArgsOperatorLessThanOrEqual PostArgsOperator = "LessThanOrEqual" - PostArgsOperatorRegEx PostArgsOperator = "RegEx" -) - -func PossibleValuesForPostArgsOperator() []string { - return []string{ - string(PostArgsOperatorAny), - string(PostArgsOperatorBeginsWith), - string(PostArgsOperatorContains), - string(PostArgsOperatorEndsWith), - string(PostArgsOperatorEqual), - string(PostArgsOperatorGreaterThan), - string(PostArgsOperatorGreaterThanOrEqual), - string(PostArgsOperatorLessThan), - string(PostArgsOperatorLessThanOrEqual), - string(PostArgsOperatorRegEx), - } -} - -func (s *PostArgsOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parsePostArgsOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parsePostArgsOperator(input string) (*PostArgsOperator, error) { - vals := map[string]PostArgsOperator{ - "any": PostArgsOperatorAny, - "beginswith": PostArgsOperatorBeginsWith, - "contains": PostArgsOperatorContains, - "endswith": PostArgsOperatorEndsWith, - "equal": PostArgsOperatorEqual, - "greaterthan": PostArgsOperatorGreaterThan, - "greaterthanorequal": PostArgsOperatorGreaterThanOrEqual, - "lessthan": PostArgsOperatorLessThan, - "lessthanorequal": PostArgsOperatorLessThanOrEqual, - "regex": PostArgsOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PostArgsOperator(input) - return &out, nil -} - -type QueryStringBehavior string - -const ( - QueryStringBehaviorExclude QueryStringBehavior = "Exclude" - QueryStringBehaviorExcludeAll QueryStringBehavior = "ExcludeAll" - QueryStringBehaviorInclude QueryStringBehavior = "Include" - QueryStringBehaviorIncludeAll QueryStringBehavior = "IncludeAll" -) - -func PossibleValuesForQueryStringBehavior() []string { - return []string{ - string(QueryStringBehaviorExclude), - string(QueryStringBehaviorExcludeAll), - string(QueryStringBehaviorInclude), - string(QueryStringBehaviorIncludeAll), - } -} - -func (s *QueryStringBehavior) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseQueryStringBehavior(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseQueryStringBehavior(input string) (*QueryStringBehavior, error) { - vals := map[string]QueryStringBehavior{ - "exclude": QueryStringBehaviorExclude, - "excludeall": QueryStringBehaviorExcludeAll, - "include": QueryStringBehaviorInclude, - "includeall": QueryStringBehaviorIncludeAll, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := QueryStringBehavior(input) - return &out, nil -} - -type QueryStringOperator string - -const ( - QueryStringOperatorAny QueryStringOperator = "Any" - QueryStringOperatorBeginsWith QueryStringOperator = "BeginsWith" - QueryStringOperatorContains QueryStringOperator = "Contains" - QueryStringOperatorEndsWith QueryStringOperator = "EndsWith" - QueryStringOperatorEqual QueryStringOperator = "Equal" - QueryStringOperatorGreaterThan QueryStringOperator = "GreaterThan" - QueryStringOperatorGreaterThanOrEqual QueryStringOperator = "GreaterThanOrEqual" - QueryStringOperatorLessThan QueryStringOperator = "LessThan" - QueryStringOperatorLessThanOrEqual QueryStringOperator = "LessThanOrEqual" - QueryStringOperatorRegEx QueryStringOperator = "RegEx" -) - -func PossibleValuesForQueryStringOperator() []string { - return []string{ - string(QueryStringOperatorAny), - string(QueryStringOperatorBeginsWith), - string(QueryStringOperatorContains), - string(QueryStringOperatorEndsWith), - string(QueryStringOperatorEqual), - string(QueryStringOperatorGreaterThan), - string(QueryStringOperatorGreaterThanOrEqual), - string(QueryStringOperatorLessThan), - string(QueryStringOperatorLessThanOrEqual), - string(QueryStringOperatorRegEx), - } -} - -func (s *QueryStringOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseQueryStringOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseQueryStringOperator(input string) (*QueryStringOperator, error) { - vals := map[string]QueryStringOperator{ - "any": QueryStringOperatorAny, - "beginswith": QueryStringOperatorBeginsWith, - "contains": QueryStringOperatorContains, - "endswith": QueryStringOperatorEndsWith, - "equal": QueryStringOperatorEqual, - "greaterthan": QueryStringOperatorGreaterThan, - "greaterthanorequal": QueryStringOperatorGreaterThanOrEqual, - "lessthan": QueryStringOperatorLessThan, - "lessthanorequal": QueryStringOperatorLessThanOrEqual, - "regex": QueryStringOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := QueryStringOperator(input) - return &out, nil -} - -type RedirectType string - -const ( - RedirectTypeFound RedirectType = "Found" - RedirectTypeMoved RedirectType = "Moved" - RedirectTypePermanentRedirect RedirectType = "PermanentRedirect" - RedirectTypeTemporaryRedirect RedirectType = "TemporaryRedirect" -) - -func PossibleValuesForRedirectType() []string { - return []string{ - string(RedirectTypeFound), - string(RedirectTypeMoved), - string(RedirectTypePermanentRedirect), - string(RedirectTypeTemporaryRedirect), - } -} - -func (s *RedirectType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRedirectType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRedirectType(input string) (*RedirectType, error) { - vals := map[string]RedirectType{ - "found": RedirectTypeFound, - "moved": RedirectTypeMoved, - "permanentredirect": RedirectTypePermanentRedirect, - "temporaryredirect": RedirectTypeTemporaryRedirect, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RedirectType(input) - return &out, nil -} - -type RemoteAddressOperator string - -const ( - RemoteAddressOperatorAny RemoteAddressOperator = "Any" - RemoteAddressOperatorGeoMatch RemoteAddressOperator = "GeoMatch" - RemoteAddressOperatorIPMatch RemoteAddressOperator = "IPMatch" -) - -func PossibleValuesForRemoteAddressOperator() []string { - return []string{ - string(RemoteAddressOperatorAny), - string(RemoteAddressOperatorGeoMatch), - string(RemoteAddressOperatorIPMatch), - } -} - -func (s *RemoteAddressOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRemoteAddressOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRemoteAddressOperator(input string) (*RemoteAddressOperator, error) { - vals := map[string]RemoteAddressOperator{ - "any": RemoteAddressOperatorAny, - "geomatch": RemoteAddressOperatorGeoMatch, - "ipmatch": RemoteAddressOperatorIPMatch, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RemoteAddressOperator(input) - return &out, nil -} - -type RequestBodyOperator string - -const ( - RequestBodyOperatorAny RequestBodyOperator = "Any" - RequestBodyOperatorBeginsWith RequestBodyOperator = "BeginsWith" - RequestBodyOperatorContains RequestBodyOperator = "Contains" - RequestBodyOperatorEndsWith RequestBodyOperator = "EndsWith" - RequestBodyOperatorEqual RequestBodyOperator = "Equal" - RequestBodyOperatorGreaterThan RequestBodyOperator = "GreaterThan" - RequestBodyOperatorGreaterThanOrEqual RequestBodyOperator = "GreaterThanOrEqual" - RequestBodyOperatorLessThan RequestBodyOperator = "LessThan" - RequestBodyOperatorLessThanOrEqual RequestBodyOperator = "LessThanOrEqual" - RequestBodyOperatorRegEx RequestBodyOperator = "RegEx" -) - -func PossibleValuesForRequestBodyOperator() []string { - return []string{ - string(RequestBodyOperatorAny), - string(RequestBodyOperatorBeginsWith), - string(RequestBodyOperatorContains), - string(RequestBodyOperatorEndsWith), - string(RequestBodyOperatorEqual), - string(RequestBodyOperatorGreaterThan), - string(RequestBodyOperatorGreaterThanOrEqual), - string(RequestBodyOperatorLessThan), - string(RequestBodyOperatorLessThanOrEqual), - string(RequestBodyOperatorRegEx), - } -} - -func (s *RequestBodyOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRequestBodyOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRequestBodyOperator(input string) (*RequestBodyOperator, error) { - vals := map[string]RequestBodyOperator{ - "any": RequestBodyOperatorAny, - "beginswith": RequestBodyOperatorBeginsWith, - "contains": RequestBodyOperatorContains, - "endswith": RequestBodyOperatorEndsWith, - "equal": RequestBodyOperatorEqual, - "greaterthan": RequestBodyOperatorGreaterThan, - "greaterthanorequal": RequestBodyOperatorGreaterThanOrEqual, - "lessthan": RequestBodyOperatorLessThan, - "lessthanorequal": RequestBodyOperatorLessThanOrEqual, - "regex": RequestBodyOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RequestBodyOperator(input) - return &out, nil -} - -type RequestHeaderOperator string - -const ( - RequestHeaderOperatorAny RequestHeaderOperator = "Any" - RequestHeaderOperatorBeginsWith RequestHeaderOperator = "BeginsWith" - RequestHeaderOperatorContains RequestHeaderOperator = "Contains" - RequestHeaderOperatorEndsWith RequestHeaderOperator = "EndsWith" - RequestHeaderOperatorEqual RequestHeaderOperator = "Equal" - RequestHeaderOperatorGreaterThan RequestHeaderOperator = "GreaterThan" - RequestHeaderOperatorGreaterThanOrEqual RequestHeaderOperator = "GreaterThanOrEqual" - RequestHeaderOperatorLessThan RequestHeaderOperator = "LessThan" - RequestHeaderOperatorLessThanOrEqual RequestHeaderOperator = "LessThanOrEqual" - RequestHeaderOperatorRegEx RequestHeaderOperator = "RegEx" -) - -func PossibleValuesForRequestHeaderOperator() []string { - return []string{ - string(RequestHeaderOperatorAny), - string(RequestHeaderOperatorBeginsWith), - string(RequestHeaderOperatorContains), - string(RequestHeaderOperatorEndsWith), - string(RequestHeaderOperatorEqual), - string(RequestHeaderOperatorGreaterThan), - string(RequestHeaderOperatorGreaterThanOrEqual), - string(RequestHeaderOperatorLessThan), - string(RequestHeaderOperatorLessThanOrEqual), - string(RequestHeaderOperatorRegEx), - } -} - -func (s *RequestHeaderOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRequestHeaderOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRequestHeaderOperator(input string) (*RequestHeaderOperator, error) { - vals := map[string]RequestHeaderOperator{ - "any": RequestHeaderOperatorAny, - "beginswith": RequestHeaderOperatorBeginsWith, - "contains": RequestHeaderOperatorContains, - "endswith": RequestHeaderOperatorEndsWith, - "equal": RequestHeaderOperatorEqual, - "greaterthan": RequestHeaderOperatorGreaterThan, - "greaterthanorequal": RequestHeaderOperatorGreaterThanOrEqual, - "lessthan": RequestHeaderOperatorLessThan, - "lessthanorequal": RequestHeaderOperatorLessThanOrEqual, - "regex": RequestHeaderOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RequestHeaderOperator(input) - return &out, nil -} - -type RequestMethodMatchValue string - -const ( - RequestMethodMatchValueDELETE RequestMethodMatchValue = "DELETE" - RequestMethodMatchValueGET RequestMethodMatchValue = "GET" - RequestMethodMatchValueHEAD RequestMethodMatchValue = "HEAD" - RequestMethodMatchValueOPTIONS RequestMethodMatchValue = "OPTIONS" - RequestMethodMatchValuePOST RequestMethodMatchValue = "POST" - RequestMethodMatchValuePUT RequestMethodMatchValue = "PUT" - RequestMethodMatchValueTRACE RequestMethodMatchValue = "TRACE" -) - -func PossibleValuesForRequestMethodMatchValue() []string { - return []string{ - string(RequestMethodMatchValueDELETE), - string(RequestMethodMatchValueGET), - string(RequestMethodMatchValueHEAD), - string(RequestMethodMatchValueOPTIONS), - string(RequestMethodMatchValuePOST), - string(RequestMethodMatchValuePUT), - string(RequestMethodMatchValueTRACE), - } -} - -func (s *RequestMethodMatchValue) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRequestMethodMatchValue(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRequestMethodMatchValue(input string) (*RequestMethodMatchValue, error) { - vals := map[string]RequestMethodMatchValue{ - "delete": RequestMethodMatchValueDELETE, - "get": RequestMethodMatchValueGET, - "head": RequestMethodMatchValueHEAD, - "options": RequestMethodMatchValueOPTIONS, - "post": RequestMethodMatchValuePOST, - "put": RequestMethodMatchValuePUT, - "trace": RequestMethodMatchValueTRACE, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RequestMethodMatchValue(input) - return &out, nil -} - -type RequestMethodOperator string - -const ( - RequestMethodOperatorEqual RequestMethodOperator = "Equal" -) - -func PossibleValuesForRequestMethodOperator() []string { - return []string{ - string(RequestMethodOperatorEqual), - } -} - -func (s *RequestMethodOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRequestMethodOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRequestMethodOperator(input string) (*RequestMethodOperator, error) { - vals := map[string]RequestMethodOperator{ - "equal": RequestMethodOperatorEqual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RequestMethodOperator(input) - return &out, nil -} - -type RequestSchemeMatchValue string - -const ( - RequestSchemeMatchValueHTTP RequestSchemeMatchValue = "HTTP" - RequestSchemeMatchValueHTTPS RequestSchemeMatchValue = "HTTPS" -) - -func PossibleValuesForRequestSchemeMatchValue() []string { - return []string{ - string(RequestSchemeMatchValueHTTP), - string(RequestSchemeMatchValueHTTPS), - } -} - -func (s *RequestSchemeMatchValue) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRequestSchemeMatchValue(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRequestSchemeMatchValue(input string) (*RequestSchemeMatchValue, error) { - vals := map[string]RequestSchemeMatchValue{ - "http": RequestSchemeMatchValueHTTP, - "https": RequestSchemeMatchValueHTTPS, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RequestSchemeMatchValue(input) - return &out, nil -} - -type RequestUriOperator string - -const ( - RequestUriOperatorAny RequestUriOperator = "Any" - RequestUriOperatorBeginsWith RequestUriOperator = "BeginsWith" - RequestUriOperatorContains RequestUriOperator = "Contains" - RequestUriOperatorEndsWith RequestUriOperator = "EndsWith" - RequestUriOperatorEqual RequestUriOperator = "Equal" - RequestUriOperatorGreaterThan RequestUriOperator = "GreaterThan" - RequestUriOperatorGreaterThanOrEqual RequestUriOperator = "GreaterThanOrEqual" - RequestUriOperatorLessThan RequestUriOperator = "LessThan" - RequestUriOperatorLessThanOrEqual RequestUriOperator = "LessThanOrEqual" - RequestUriOperatorRegEx RequestUriOperator = "RegEx" -) - -func PossibleValuesForRequestUriOperator() []string { - return []string{ - string(RequestUriOperatorAny), - string(RequestUriOperatorBeginsWith), - string(RequestUriOperatorContains), - string(RequestUriOperatorEndsWith), - string(RequestUriOperatorEqual), - string(RequestUriOperatorGreaterThan), - string(RequestUriOperatorGreaterThanOrEqual), - string(RequestUriOperatorLessThan), - string(RequestUriOperatorLessThanOrEqual), - string(RequestUriOperatorRegEx), - } -} - -func (s *RequestUriOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRequestUriOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRequestUriOperator(input string) (*RequestUriOperator, error) { - vals := map[string]RequestUriOperator{ - "any": RequestUriOperatorAny, - "beginswith": RequestUriOperatorBeginsWith, - "contains": RequestUriOperatorContains, - "endswith": RequestUriOperatorEndsWith, - "equal": RequestUriOperatorEqual, - "greaterthan": RequestUriOperatorGreaterThan, - "greaterthanorequal": RequestUriOperatorGreaterThanOrEqual, - "lessthan": RequestUriOperatorLessThan, - "lessthanorequal": RequestUriOperatorLessThanOrEqual, - "regex": RequestUriOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RequestUriOperator(input) - return &out, nil -} - -type RuleCacheBehavior string - -const ( - RuleCacheBehaviorHonorOrigin RuleCacheBehavior = "HonorOrigin" - RuleCacheBehaviorOverrideAlways RuleCacheBehavior = "OverrideAlways" - RuleCacheBehaviorOverrideIfOriginMissing RuleCacheBehavior = "OverrideIfOriginMissing" -) - -func PossibleValuesForRuleCacheBehavior() []string { - return []string{ - string(RuleCacheBehaviorHonorOrigin), - string(RuleCacheBehaviorOverrideAlways), - string(RuleCacheBehaviorOverrideIfOriginMissing), - } -} - -func (s *RuleCacheBehavior) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRuleCacheBehavior(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRuleCacheBehavior(input string) (*RuleCacheBehavior, error) { - vals := map[string]RuleCacheBehavior{ - "honororigin": RuleCacheBehaviorHonorOrigin, - "overridealways": RuleCacheBehaviorOverrideAlways, - "overrideiforiginmissing": RuleCacheBehaviorOverrideIfOriginMissing, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RuleCacheBehavior(input) - return &out, nil -} - -type RuleIsCompressionEnabled string - -const ( - RuleIsCompressionEnabledDisabled RuleIsCompressionEnabled = "Disabled" - RuleIsCompressionEnabledEnabled RuleIsCompressionEnabled = "Enabled" -) - -func PossibleValuesForRuleIsCompressionEnabled() []string { - return []string{ - string(RuleIsCompressionEnabledDisabled), - string(RuleIsCompressionEnabledEnabled), - } -} - -func (s *RuleIsCompressionEnabled) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRuleIsCompressionEnabled(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRuleIsCompressionEnabled(input string) (*RuleIsCompressionEnabled, error) { - vals := map[string]RuleIsCompressionEnabled{ - "disabled": RuleIsCompressionEnabledDisabled, - "enabled": RuleIsCompressionEnabledEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RuleIsCompressionEnabled(input) - return &out, nil -} - -type RuleQueryStringCachingBehavior string - -const ( - RuleQueryStringCachingBehaviorIgnoreQueryString RuleQueryStringCachingBehavior = "IgnoreQueryString" - RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings RuleQueryStringCachingBehavior = "IgnoreSpecifiedQueryStrings" - RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings RuleQueryStringCachingBehavior = "IncludeSpecifiedQueryStrings" - RuleQueryStringCachingBehaviorUseQueryString RuleQueryStringCachingBehavior = "UseQueryString" -) - -func PossibleValuesForRuleQueryStringCachingBehavior() []string { - return []string{ - string(RuleQueryStringCachingBehaviorIgnoreQueryString), - string(RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings), - string(RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings), - string(RuleQueryStringCachingBehaviorUseQueryString), - } -} - -func (s *RuleQueryStringCachingBehavior) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRuleQueryStringCachingBehavior(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRuleQueryStringCachingBehavior(input string) (*RuleQueryStringCachingBehavior, error) { - vals := map[string]RuleQueryStringCachingBehavior{ - "ignorequerystring": RuleQueryStringCachingBehaviorIgnoreQueryString, - "ignorespecifiedquerystrings": RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings, - "includespecifiedquerystrings": RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings, - "usequerystring": RuleQueryStringCachingBehaviorUseQueryString, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RuleQueryStringCachingBehavior(input) - return &out, nil -} - -type ServerPortOperator string - -const ( - ServerPortOperatorAny ServerPortOperator = "Any" - ServerPortOperatorBeginsWith ServerPortOperator = "BeginsWith" - ServerPortOperatorContains ServerPortOperator = "Contains" - ServerPortOperatorEndsWith ServerPortOperator = "EndsWith" - ServerPortOperatorEqual ServerPortOperator = "Equal" - ServerPortOperatorGreaterThan ServerPortOperator = "GreaterThan" - ServerPortOperatorGreaterThanOrEqual ServerPortOperator = "GreaterThanOrEqual" - ServerPortOperatorLessThan ServerPortOperator = "LessThan" - ServerPortOperatorLessThanOrEqual ServerPortOperator = "LessThanOrEqual" - ServerPortOperatorRegEx ServerPortOperator = "RegEx" -) - -func PossibleValuesForServerPortOperator() []string { - return []string{ - string(ServerPortOperatorAny), - string(ServerPortOperatorBeginsWith), - string(ServerPortOperatorContains), - string(ServerPortOperatorEndsWith), - string(ServerPortOperatorEqual), - string(ServerPortOperatorGreaterThan), - string(ServerPortOperatorGreaterThanOrEqual), - string(ServerPortOperatorLessThan), - string(ServerPortOperatorLessThanOrEqual), - string(ServerPortOperatorRegEx), - } -} - -func (s *ServerPortOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServerPortOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServerPortOperator(input string) (*ServerPortOperator, error) { - vals := map[string]ServerPortOperator{ - "any": ServerPortOperatorAny, - "beginswith": ServerPortOperatorBeginsWith, - "contains": ServerPortOperatorContains, - "endswith": ServerPortOperatorEndsWith, - "equal": ServerPortOperatorEqual, - "greaterthan": ServerPortOperatorGreaterThan, - "greaterthanorequal": ServerPortOperatorGreaterThanOrEqual, - "lessthan": ServerPortOperatorLessThan, - "lessthanorequal": ServerPortOperatorLessThanOrEqual, - "regex": ServerPortOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServerPortOperator(input) - return &out, nil -} - -type SocketAddrOperator string - -const ( - SocketAddrOperatorAny SocketAddrOperator = "Any" - SocketAddrOperatorIPMatch SocketAddrOperator = "IPMatch" -) - -func PossibleValuesForSocketAddrOperator() []string { - return []string{ - string(SocketAddrOperatorAny), - string(SocketAddrOperatorIPMatch), - } -} - -func (s *SocketAddrOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSocketAddrOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSocketAddrOperator(input string) (*SocketAddrOperator, error) { - vals := map[string]SocketAddrOperator{ - "any": SocketAddrOperatorAny, - "ipmatch": SocketAddrOperatorIPMatch, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SocketAddrOperator(input) - return &out, nil -} - -type SslProtocol string - -const ( - SslProtocolTLSvOne SslProtocol = "TLSv1" - SslProtocolTLSvOnePointOne SslProtocol = "TLSv1.1" - SslProtocolTLSvOnePointTwo SslProtocol = "TLSv1.2" -) - -func PossibleValuesForSslProtocol() []string { - return []string{ - string(SslProtocolTLSvOne), - string(SslProtocolTLSvOnePointOne), - string(SslProtocolTLSvOnePointTwo), - } -} - -func (s *SslProtocol) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSslProtocol(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSslProtocol(input string) (*SslProtocol, error) { - vals := map[string]SslProtocol{ - "tlsv1": SslProtocolTLSvOne, - "tlsv1.1": SslProtocolTLSvOnePointOne, - "tlsv1.2": SslProtocolTLSvOnePointTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SslProtocol(input) - return &out, nil -} - -type SslProtocolOperator string - -const ( - SslProtocolOperatorEqual SslProtocolOperator = "Equal" -) - -func PossibleValuesForSslProtocolOperator() []string { - return []string{ - string(SslProtocolOperatorEqual), - } -} - -func (s *SslProtocolOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSslProtocolOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSslProtocolOperator(input string) (*SslProtocolOperator, error) { - vals := map[string]SslProtocolOperator{ - "equal": SslProtocolOperatorEqual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SslProtocolOperator(input) - return &out, nil -} - -type Transform string - -const ( - TransformLowercase Transform = "Lowercase" - TransformRemoveNulls Transform = "RemoveNulls" - TransformTrim Transform = "Trim" - TransformURLDecode Transform = "UrlDecode" - TransformURLEncode Transform = "UrlEncode" - TransformUppercase Transform = "Uppercase" -) - -func PossibleValuesForTransform() []string { - return []string{ - string(TransformLowercase), - string(TransformRemoveNulls), - string(TransformTrim), - string(TransformURLDecode), - string(TransformURLEncode), - string(TransformUppercase), - } -} - -func (s *Transform) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseTransform(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseTransform(input string) (*Transform, error) { - vals := map[string]Transform{ - "lowercase": TransformLowercase, - "removenulls": TransformRemoveNulls, - "trim": TransformTrim, - "urldecode": TransformURLDecode, - "urlencode": TransformURLEncode, - "uppercase": TransformUppercase, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Transform(input) - return &out, nil -} - -type URLFileExtensionOperator string - -const ( - URLFileExtensionOperatorAny URLFileExtensionOperator = "Any" - URLFileExtensionOperatorBeginsWith URLFileExtensionOperator = "BeginsWith" - URLFileExtensionOperatorContains URLFileExtensionOperator = "Contains" - URLFileExtensionOperatorEndsWith URLFileExtensionOperator = "EndsWith" - URLFileExtensionOperatorEqual URLFileExtensionOperator = "Equal" - URLFileExtensionOperatorGreaterThan URLFileExtensionOperator = "GreaterThan" - URLFileExtensionOperatorGreaterThanOrEqual URLFileExtensionOperator = "GreaterThanOrEqual" - URLFileExtensionOperatorLessThan URLFileExtensionOperator = "LessThan" - URLFileExtensionOperatorLessThanOrEqual URLFileExtensionOperator = "LessThanOrEqual" - URLFileExtensionOperatorRegEx URLFileExtensionOperator = "RegEx" -) - -func PossibleValuesForURLFileExtensionOperator() []string { - return []string{ - string(URLFileExtensionOperatorAny), - string(URLFileExtensionOperatorBeginsWith), - string(URLFileExtensionOperatorContains), - string(URLFileExtensionOperatorEndsWith), - string(URLFileExtensionOperatorEqual), - string(URLFileExtensionOperatorGreaterThan), - string(URLFileExtensionOperatorGreaterThanOrEqual), - string(URLFileExtensionOperatorLessThan), - string(URLFileExtensionOperatorLessThanOrEqual), - string(URLFileExtensionOperatorRegEx), - } -} - -func (s *URLFileExtensionOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseURLFileExtensionOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseURLFileExtensionOperator(input string) (*URLFileExtensionOperator, error) { - vals := map[string]URLFileExtensionOperator{ - "any": URLFileExtensionOperatorAny, - "beginswith": URLFileExtensionOperatorBeginsWith, - "contains": URLFileExtensionOperatorContains, - "endswith": URLFileExtensionOperatorEndsWith, - "equal": URLFileExtensionOperatorEqual, - "greaterthan": URLFileExtensionOperatorGreaterThan, - "greaterthanorequal": URLFileExtensionOperatorGreaterThanOrEqual, - "lessthan": URLFileExtensionOperatorLessThan, - "lessthanorequal": URLFileExtensionOperatorLessThanOrEqual, - "regex": URLFileExtensionOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := URLFileExtensionOperator(input) - return &out, nil -} - -type URLFileNameOperator string - -const ( - URLFileNameOperatorAny URLFileNameOperator = "Any" - URLFileNameOperatorBeginsWith URLFileNameOperator = "BeginsWith" - URLFileNameOperatorContains URLFileNameOperator = "Contains" - URLFileNameOperatorEndsWith URLFileNameOperator = "EndsWith" - URLFileNameOperatorEqual URLFileNameOperator = "Equal" - URLFileNameOperatorGreaterThan URLFileNameOperator = "GreaterThan" - URLFileNameOperatorGreaterThanOrEqual URLFileNameOperator = "GreaterThanOrEqual" - URLFileNameOperatorLessThan URLFileNameOperator = "LessThan" - URLFileNameOperatorLessThanOrEqual URLFileNameOperator = "LessThanOrEqual" - URLFileNameOperatorRegEx URLFileNameOperator = "RegEx" -) - -func PossibleValuesForURLFileNameOperator() []string { - return []string{ - string(URLFileNameOperatorAny), - string(URLFileNameOperatorBeginsWith), - string(URLFileNameOperatorContains), - string(URLFileNameOperatorEndsWith), - string(URLFileNameOperatorEqual), - string(URLFileNameOperatorGreaterThan), - string(URLFileNameOperatorGreaterThanOrEqual), - string(URLFileNameOperatorLessThan), - string(URLFileNameOperatorLessThanOrEqual), - string(URLFileNameOperatorRegEx), - } -} - -func (s *URLFileNameOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseURLFileNameOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseURLFileNameOperator(input string) (*URLFileNameOperator, error) { - vals := map[string]URLFileNameOperator{ - "any": URLFileNameOperatorAny, - "beginswith": URLFileNameOperatorBeginsWith, - "contains": URLFileNameOperatorContains, - "endswith": URLFileNameOperatorEndsWith, - "equal": URLFileNameOperatorEqual, - "greaterthan": URLFileNameOperatorGreaterThan, - "greaterthanorequal": URLFileNameOperatorGreaterThanOrEqual, - "lessthan": URLFileNameOperatorLessThan, - "lessthanorequal": URLFileNameOperatorLessThanOrEqual, - "regex": URLFileNameOperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := URLFileNameOperator(input) - return &out, nil -} - -type URLPathOperator string - -const ( - URLPathOperatorAny URLPathOperator = "Any" - URLPathOperatorBeginsWith URLPathOperator = "BeginsWith" - URLPathOperatorContains URLPathOperator = "Contains" - URLPathOperatorEndsWith URLPathOperator = "EndsWith" - URLPathOperatorEqual URLPathOperator = "Equal" - URLPathOperatorGreaterThan URLPathOperator = "GreaterThan" - URLPathOperatorGreaterThanOrEqual URLPathOperator = "GreaterThanOrEqual" - URLPathOperatorLessThan URLPathOperator = "LessThan" - URLPathOperatorLessThanOrEqual URLPathOperator = "LessThanOrEqual" - URLPathOperatorRegEx URLPathOperator = "RegEx" - URLPathOperatorWildcard URLPathOperator = "Wildcard" -) - -func PossibleValuesForURLPathOperator() []string { - return []string{ - string(URLPathOperatorAny), - string(URLPathOperatorBeginsWith), - string(URLPathOperatorContains), - string(URLPathOperatorEndsWith), - string(URLPathOperatorEqual), - string(URLPathOperatorGreaterThan), - string(URLPathOperatorGreaterThanOrEqual), - string(URLPathOperatorLessThan), - string(URLPathOperatorLessThanOrEqual), - string(URLPathOperatorRegEx), - string(URLPathOperatorWildcard), - } -} - -func (s *URLPathOperator) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseURLPathOperator(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseURLPathOperator(input string) (*URLPathOperator, error) { - vals := map[string]URLPathOperator{ - "any": URLPathOperatorAny, - "beginswith": URLPathOperatorBeginsWith, - "contains": URLPathOperatorContains, - "endswith": URLPathOperatorEndsWith, - "equal": URLPathOperatorEqual, - "greaterthan": URLPathOperatorGreaterThan, - "greaterthanorequal": URLPathOperatorGreaterThanOrEqual, - "lessthan": URLPathOperatorLessThan, - "lessthanorequal": URLPathOperatorLessThanOrEqual, - "regex": URLPathOperatorRegEx, - "wildcard": URLPathOperatorWildcard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := URLPathOperator(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_rule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_rule.go deleted file mode 100644 index 82e145de4595..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_rule.go +++ /dev/null @@ -1,148 +0,0 @@ -package rules - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&RuleId{}) -} - -var _ resourceids.ResourceId = &RuleId{} - -// RuleId is a struct representing the Resource ID for a Rule -type RuleId struct { - SubscriptionId string - ResourceGroupName string - ProfileName string - RuleSetName string - RuleName string -} - -// NewRuleID returns a new RuleId struct -func NewRuleID(subscriptionId string, resourceGroupName string, profileName string, ruleSetName string, ruleName string) RuleId { - return RuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ProfileName: profileName, - RuleSetName: ruleSetName, - RuleName: ruleName, - } -} - -// ParseRuleID parses 'input' into a RuleId -func ParseRuleID(input string) (*RuleId, error) { - parser := resourceids.NewParserFromResourceIdType(&RuleId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := RuleId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseRuleIDInsensitively parses 'input' case-insensitively into a RuleId -// note: this method should only be used for API response data and not user input -func ParseRuleIDInsensitively(input string) (*RuleId, error) { - parser := resourceids.NewParserFromResourceIdType(&RuleId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := RuleId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *RuleId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.ProfileName, ok = input.Parsed["profileName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "profileName", input) - } - - if id.RuleSetName, ok = input.Parsed["ruleSetName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "ruleSetName", input) - } - - if id.RuleName, ok = input.Parsed["ruleName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) - } - - return nil -} - -// ValidateRuleID checks that 'input' can be parsed as a Rule ID -func ValidateRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Rule ID -func (id RuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/ruleSets/%s/rules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName, id.RuleSetName, id.RuleName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Rule ID -func (id RuleId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftCdn", "Microsoft.Cdn", "Microsoft.Cdn"), - resourceids.StaticSegment("staticProfiles", "profiles", "profiles"), - resourceids.UserSpecifiedSegment("profileName", "profileName"), - resourceids.StaticSegment("staticRuleSets", "ruleSets", "ruleSets"), - resourceids.UserSpecifiedSegment("ruleSetName", "ruleSetName"), - resourceids.StaticSegment("staticRules", "rules", "rules"), - resourceids.UserSpecifiedSegment("ruleName", "ruleName"), - } -} - -// String returns a human-readable description of this Rule ID -func (id RuleId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Profile Name: %q", id.ProfileName), - fmt.Sprintf("Rule Set Name: %q", id.RuleSetName), - fmt.Sprintf("Rule Name: %q", id.RuleName), - } - return fmt.Sprintf("Rule (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_ruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_ruleset.go deleted file mode 100644 index c477a9f4e744..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_ruleset.go +++ /dev/null @@ -1,139 +0,0 @@ -package rules - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&RuleSetId{}) -} - -var _ resourceids.ResourceId = &RuleSetId{} - -// RuleSetId is a struct representing the Resource ID for a Rule Set -type RuleSetId struct { - SubscriptionId string - ResourceGroupName string - ProfileName string - RuleSetName string -} - -// NewRuleSetID returns a new RuleSetId struct -func NewRuleSetID(subscriptionId string, resourceGroupName string, profileName string, ruleSetName string) RuleSetId { - return RuleSetId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ProfileName: profileName, - RuleSetName: ruleSetName, - } -} - -// ParseRuleSetID parses 'input' into a RuleSetId -func ParseRuleSetID(input string) (*RuleSetId, error) { - parser := resourceids.NewParserFromResourceIdType(&RuleSetId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := RuleSetId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseRuleSetIDInsensitively parses 'input' case-insensitively into a RuleSetId -// note: this method should only be used for API response data and not user input -func ParseRuleSetIDInsensitively(input string) (*RuleSetId, error) { - parser := resourceids.NewParserFromResourceIdType(&RuleSetId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := RuleSetId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *RuleSetId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.ProfileName, ok = input.Parsed["profileName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "profileName", input) - } - - if id.RuleSetName, ok = input.Parsed["ruleSetName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "ruleSetName", input) - } - - return nil -} - -// ValidateRuleSetID checks that 'input' can be parsed as a Rule Set ID -func ValidateRuleSetID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseRuleSetID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Rule Set ID -func (id RuleSetId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/ruleSets/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName, id.RuleSetName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Rule Set ID -func (id RuleSetId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftCdn", "Microsoft.Cdn", "Microsoft.Cdn"), - resourceids.StaticSegment("staticProfiles", "profiles", "profiles"), - resourceids.UserSpecifiedSegment("profileName", "profileName"), - resourceids.StaticSegment("staticRuleSets", "ruleSets", "ruleSets"), - resourceids.UserSpecifiedSegment("ruleSetName", "ruleSetName"), - } -} - -// String returns a human-readable description of this Rule Set ID -func (id RuleSetId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Profile Name: %q", id.ProfileName), - fmt.Sprintf("Rule Set Name: %q", id.RuleSetName), - } - return fmt.Sprintf("Rule Set (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_create.go deleted file mode 100644 index 84a6f02dc5e1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_create.go +++ /dev/null @@ -1,76 +0,0 @@ -package rules - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData - Model *Rule -} - -// Create ... -func (c RulesClient) Create(ctx context.Context, id RuleId, input Rule) (result CreateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusCreated, - http.StatusOK, - }, - HttpMethod: http.MethodPut, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) - if err != nil { - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c RulesClient) CreateThenPoll(ctx context.Context, id RuleId, input Rule) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_delete.go deleted file mode 100644 index beb0bc70b2ef..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package rules - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// Delete ... -func (c RulesClient) Delete(ctx context.Context, id RuleId) (result DeleteOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusNoContent, - http.StatusOK, - }, - HttpMethod: http.MethodDelete, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) - if err != nil { - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c RulesClient) DeleteThenPoll(ctx context.Context, id RuleId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_get.go deleted file mode 100644 index fb626b44bac0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_get.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *Rule -} - -// Get ... -func (c RulesClient) Get(ctx context.Context, id RuleId) (result GetOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model Rule - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_listbyruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_listbyruleset.go deleted file mode 100644 index 45074b4d0143..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_listbyruleset.go +++ /dev/null @@ -1,105 +0,0 @@ -package rules - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByRuleSetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]Rule -} - -type ListByRuleSetCompleteResult struct { - LatestHttpResponse *http.Response - Items []Rule -} - -type ListByRuleSetCustomPager struct { - NextLink *odata.Link `json:"nextLink"` -} - -func (p *ListByRuleSetCustomPager) NextPageLink() *odata.Link { - defer func() { - p.NextLink = nil - }() - - return p.NextLink -} - -// ListByRuleSet ... -func (c RulesClient) ListByRuleSet(ctx context.Context, id RuleSetId) (result ListByRuleSetOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Pager: &ListByRuleSetCustomPager{}, - Path: fmt.Sprintf("%s/rules", id.ID()), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.ExecutePaged(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var values struct { - Values *[]Rule `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListByRuleSetComplete retrieves all the results into a single object -func (c RulesClient) ListByRuleSetComplete(ctx context.Context, id RuleSetId) (ListByRuleSetCompleteResult, error) { - return c.ListByRuleSetCompleteMatchingPredicate(ctx, id, RuleOperationPredicate{}) -} - -// ListByRuleSetCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c RulesClient) ListByRuleSetCompleteMatchingPredicate(ctx context.Context, id RuleSetId, predicate RuleOperationPredicate) (result ListByRuleSetCompleteResult, err error) { - items := make([]Rule, 0) - - resp, err := c.ListByRuleSet(ctx, id) - if err != nil { - result.LatestHttpResponse = resp.HttpResponse - err = fmt.Errorf("loading results: %+v", err) - return - } - if resp.Model != nil { - for _, v := range *resp.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - result = ListByRuleSetCompleteResult{ - LatestHttpResponse: resp.HttpResponse, - Items: items, - } - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_update.go deleted file mode 100644 index 1d7a1bd0f418..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_update.go +++ /dev/null @@ -1,75 +0,0 @@ -package rules - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData - Model *Rule -} - -// Update ... -func (c RulesClient) Update(ctx context.Context, id RuleId, input RuleUpdateParameters) (result UpdateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPatch, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) - if err != nil { - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c RulesClient) UpdateThenPoll(ctx context.Context, id RuleId, input RuleUpdateParameters) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheconfiguration.go deleted file mode 100644 index af68de873acf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheconfiguration.go +++ /dev/null @@ -1,12 +0,0 @@ -package rules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CacheConfiguration struct { - CacheBehavior *RuleCacheBehavior `json:"cacheBehavior,omitempty"` - CacheDuration *string `json:"cacheDuration,omitempty"` - IsCompressionEnabled *RuleIsCompressionEnabled `json:"isCompressionEnabled,omitempty"` - QueryParameters *string `json:"queryParameters,omitempty"` - QueryStringCachingBehavior *RuleQueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheexpirationactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheexpirationactionparameters.go deleted file mode 100644 index 77c5d8d30821..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheexpirationactionparameters.go +++ /dev/null @@ -1,52 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleActionParameters = CacheExpirationActionParameters{} - -type CacheExpirationActionParameters struct { - CacheBehavior CacheBehavior `json:"cacheBehavior"` - CacheDuration *string `json:"cacheDuration,omitempty"` - CacheType CacheType `json:"cacheType"` - - // Fields inherited from DeliveryRuleActionParameters - - TypeName DeliveryRuleActionParametersType `json:"typeName"` -} - -func (s CacheExpirationActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return BaseDeliveryRuleActionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = CacheExpirationActionParameters{} - -func (s CacheExpirationActionParameters) MarshalJSON() ([]byte, error) { - type wrapper CacheExpirationActionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling CacheExpirationActionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling CacheExpirationActionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleCacheExpirationActionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling CacheExpirationActionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cachekeyquerystringactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cachekeyquerystringactionparameters.go deleted file mode 100644 index b552b31226e5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cachekeyquerystringactionparameters.go +++ /dev/null @@ -1,51 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleActionParameters = CacheKeyQueryStringActionParameters{} - -type CacheKeyQueryStringActionParameters struct { - QueryParameters *string `json:"queryParameters,omitempty"` - QueryStringBehavior QueryStringBehavior `json:"queryStringBehavior"` - - // Fields inherited from DeliveryRuleActionParameters - - TypeName DeliveryRuleActionParametersType `json:"typeName"` -} - -func (s CacheKeyQueryStringActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return BaseDeliveryRuleActionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = CacheKeyQueryStringActionParameters{} - -func (s CacheKeyQueryStringActionParameters) MarshalJSON() ([]byte, error) { - type wrapper CacheKeyQueryStringActionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling CacheKeyQueryStringActionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling CacheKeyQueryStringActionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling CacheKeyQueryStringActionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_clientportmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_clientportmatchconditionparameters.go deleted file mode 100644 index f989d7c03140..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_clientportmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = ClientPortMatchConditionParameters{} - -type ClientPortMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator ClientPortOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s ClientPortMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = ClientPortMatchConditionParameters{} - -func (s ClientPortMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper ClientPortMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ClientPortMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ClientPortMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleClientPortConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ClientPortMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cookiesmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cookiesmatchconditionparameters.go deleted file mode 100644 index 63296e5671a4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cookiesmatchconditionparameters.go +++ /dev/null @@ -1,54 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = CookiesMatchConditionParameters{} - -type CookiesMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator CookiesOperator `json:"operator"` - Selector *string `json:"selector,omitempty"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s CookiesMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = CookiesMatchConditionParameters{} - -func (s CookiesMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper CookiesMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling CookiesMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling CookiesMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleCookiesConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling CookiesMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleaction.go deleted file mode 100644 index c9742f9ceb76..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleaction.go +++ /dev/null @@ -1,139 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeliveryRuleAction interface { - DeliveryRuleAction() BaseDeliveryRuleActionImpl -} - -var _ DeliveryRuleAction = BaseDeliveryRuleActionImpl{} - -type BaseDeliveryRuleActionImpl struct { - Name DeliveryRuleActionName `json:"name"` -} - -func (s BaseDeliveryRuleActionImpl) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return s -} - -var _ DeliveryRuleAction = RawDeliveryRuleActionImpl{} - -// RawDeliveryRuleActionImpl is returned when the Discriminated Value doesn't match any of the defined types -// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) -// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). -type RawDeliveryRuleActionImpl struct { - deliveryRuleAction BaseDeliveryRuleActionImpl - Type string - Values map[string]interface{} -} - -func (s RawDeliveryRuleActionImpl) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return s.deliveryRuleAction -} - -func UnmarshalDeliveryRuleActionImplementation(input []byte) (DeliveryRuleAction, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleAction into map[string]interface: %+v", err) - } - - var value string - if v, ok := temp["name"]; ok { - value = fmt.Sprintf("%v", v) - } - - if strings.EqualFold(value, "CacheExpiration") { - var out DeliveryRuleCacheExpirationAction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleCacheExpirationAction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "CacheKeyQueryString") { - var out DeliveryRuleCacheKeyQueryStringAction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleCacheKeyQueryStringAction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "ModifyRequestHeader") { - var out DeliveryRuleRequestHeaderAction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestHeaderAction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "ModifyResponseHeader") { - var out DeliveryRuleResponseHeaderAction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleResponseHeaderAction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "RouteConfigurationOverride") { - var out DeliveryRuleRouteConfigurationOverrideAction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleRouteConfigurationOverrideAction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "OriginGroupOverride") { - var out OriginGroupOverrideAction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into OriginGroupOverrideAction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "UrlRedirect") { - var out URLRedirectAction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into URLRedirectAction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "UrlRewrite") { - var out URLRewriteAction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into URLRewriteAction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "UrlSigning") { - var out URLSigningAction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into URLSigningAction: %+v", err) - } - return out, nil - } - - var parent BaseDeliveryRuleActionImpl - if err := json.Unmarshal(input, &parent); err != nil { - return nil, fmt.Errorf("unmarshaling into BaseDeliveryRuleActionImpl: %+v", err) - } - - return RawDeliveryRuleActionImpl{ - deliveryRuleAction: parent, - Type: value, - Values: temp, - }, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleactionparameters.go deleted file mode 100644 index f6a9cc5b1c63..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleactionparameters.go +++ /dev/null @@ -1,131 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeliveryRuleActionParameters interface { - DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl -} - -var _ DeliveryRuleActionParameters = BaseDeliveryRuleActionParametersImpl{} - -type BaseDeliveryRuleActionParametersImpl struct { - TypeName DeliveryRuleActionParametersType `json:"typeName"` -} - -func (s BaseDeliveryRuleActionParametersImpl) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return s -} - -var _ DeliveryRuleActionParameters = RawDeliveryRuleActionParametersImpl{} - -// RawDeliveryRuleActionParametersImpl is returned when the Discriminated Value doesn't match any of the defined types -// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) -// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). -type RawDeliveryRuleActionParametersImpl struct { - deliveryRuleActionParameters BaseDeliveryRuleActionParametersImpl - Type string - Values map[string]interface{} -} - -func (s RawDeliveryRuleActionParametersImpl) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return s.deliveryRuleActionParameters -} - -func UnmarshalDeliveryRuleActionParametersImplementation(input []byte) (DeliveryRuleActionParameters, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleActionParameters into map[string]interface: %+v", err) - } - - var value string - if v, ok := temp["typeName"]; ok { - value = fmt.Sprintf("%v", v) - } - - if strings.EqualFold(value, "DeliveryRuleCacheExpirationActionParameters") { - var out CacheExpirationActionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into CacheExpirationActionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters") { - var out CacheKeyQueryStringActionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into CacheKeyQueryStringActionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleHeaderActionParameters") { - var out HeaderActionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into HeaderActionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleOriginGroupOverrideActionParameters") { - var out OriginGroupOverrideActionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into OriginGroupOverrideActionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleRouteConfigurationOverrideActionParameters") { - var out RouteConfigurationOverrideActionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RouteConfigurationOverrideActionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleUrlRedirectActionParameters") { - var out URLRedirectActionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into URLRedirectActionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleUrlRewriteActionParameters") { - var out URLRewriteActionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into URLRewriteActionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleUrlSigningActionParameters") { - var out URLSigningActionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into URLSigningActionParameters: %+v", err) - } - return out, nil - } - - var parent BaseDeliveryRuleActionParametersImpl - if err := json.Unmarshal(input, &parent); err != nil { - return nil, fmt.Errorf("unmarshaling into BaseDeliveryRuleActionParametersImpl: %+v", err) - } - - return RawDeliveryRuleActionParametersImpl{ - deliveryRuleActionParameters: parent, - Type: value, - Values: temp, - }, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecacheexpirationaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecacheexpirationaction.go deleted file mode 100644 index 2106d68c5436..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecacheexpirationaction.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleAction = DeliveryRuleCacheExpirationAction{} - -type DeliveryRuleCacheExpirationAction struct { - Parameters CacheExpirationActionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleAction - - Name DeliveryRuleActionName `json:"name"` -} - -func (s DeliveryRuleCacheExpirationAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return BaseDeliveryRuleActionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleCacheExpirationAction{} - -func (s DeliveryRuleCacheExpirationAction) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleCacheExpirationAction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleCacheExpirationAction: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleCacheExpirationAction: %+v", err) - } - - decoded["name"] = "CacheExpiration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleCacheExpirationAction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecachekeyquerystringaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecachekeyquerystringaction.go deleted file mode 100644 index db7fa3798f67..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecachekeyquerystringaction.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleAction = DeliveryRuleCacheKeyQueryStringAction{} - -type DeliveryRuleCacheKeyQueryStringAction struct { - Parameters CacheKeyQueryStringActionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleAction - - Name DeliveryRuleActionName `json:"name"` -} - -func (s DeliveryRuleCacheKeyQueryStringAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return BaseDeliveryRuleActionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleCacheKeyQueryStringAction{} - -func (s DeliveryRuleCacheKeyQueryStringAction) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleCacheKeyQueryStringAction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleCacheKeyQueryStringAction: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleCacheKeyQueryStringAction: %+v", err) - } - - decoded["name"] = "CacheKeyQueryString" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleCacheKeyQueryStringAction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleclientportcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleclientportcondition.go deleted file mode 100644 index c825b6620918..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleclientportcondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleClientPortCondition{} - -type DeliveryRuleClientPortCondition struct { - Parameters ClientPortMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleClientPortCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleClientPortCondition{} - -func (s DeliveryRuleClientPortCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleClientPortCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleClientPortCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleClientPortCondition: %+v", err) - } - - decoded["name"] = "ClientPort" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleClientPortCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecondition.go deleted file mode 100644 index f82db88bf3ff..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecondition.go +++ /dev/null @@ -1,219 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeliveryRuleCondition interface { - DeliveryRuleCondition() BaseDeliveryRuleConditionImpl -} - -var _ DeliveryRuleCondition = BaseDeliveryRuleConditionImpl{} - -type BaseDeliveryRuleConditionImpl struct { - Name MatchVariable `json:"name"` -} - -func (s BaseDeliveryRuleConditionImpl) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return s -} - -var _ DeliveryRuleCondition = RawDeliveryRuleConditionImpl{} - -// RawDeliveryRuleConditionImpl is returned when the Discriminated Value doesn't match any of the defined types -// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) -// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). -type RawDeliveryRuleConditionImpl struct { - deliveryRuleCondition BaseDeliveryRuleConditionImpl - Type string - Values map[string]interface{} -} - -func (s RawDeliveryRuleConditionImpl) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return s.deliveryRuleCondition -} - -func UnmarshalDeliveryRuleConditionImplementation(input []byte) (DeliveryRuleCondition, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleCondition into map[string]interface: %+v", err) - } - - var value string - if v, ok := temp["name"]; ok { - value = fmt.Sprintf("%v", v) - } - - if strings.EqualFold(value, "ClientPort") { - var out DeliveryRuleClientPortCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleClientPortCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "Cookies") { - var out DeliveryRuleCookiesCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleCookiesCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "HttpVersion") { - var out DeliveryRuleHTTPVersionCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleHTTPVersionCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "HostName") { - var out DeliveryRuleHostNameCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleHostNameCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "IsDevice") { - var out DeliveryRuleIsDeviceCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleIsDeviceCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "PostArgs") { - var out DeliveryRulePostArgsCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRulePostArgsCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "QueryString") { - var out DeliveryRuleQueryStringCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleQueryStringCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "RemoteAddress") { - var out DeliveryRuleRemoteAddressCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleRemoteAddressCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "RequestBody") { - var out DeliveryRuleRequestBodyCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestBodyCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "RequestHeader") { - var out DeliveryRuleRequestHeaderCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestHeaderCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "RequestMethod") { - var out DeliveryRuleRequestMethodCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestMethodCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "RequestScheme") { - var out DeliveryRuleRequestSchemeCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestSchemeCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "RequestUri") { - var out DeliveryRuleRequestUriCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleRequestUriCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "ServerPort") { - var out DeliveryRuleServerPortCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleServerPortCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "SocketAddr") { - var out DeliveryRuleSocketAddrCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleSocketAddrCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "SslProtocol") { - var out DeliveryRuleSslProtocolCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleSslProtocolCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "UrlFileExtension") { - var out DeliveryRuleURLFileExtensionCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleURLFileExtensionCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "UrlFileName") { - var out DeliveryRuleURLFileNameCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleURLFileNameCondition: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "UrlPath") { - var out DeliveryRuleURLPathCondition - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DeliveryRuleURLPathCondition: %+v", err) - } - return out, nil - } - - var parent BaseDeliveryRuleConditionImpl - if err := json.Unmarshal(input, &parent); err != nil { - return nil, fmt.Errorf("unmarshaling into BaseDeliveryRuleConditionImpl: %+v", err) - } - - return RawDeliveryRuleConditionImpl{ - deliveryRuleCondition: parent, - Type: value, - Values: temp, - }, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleconditionparameters.go deleted file mode 100644 index f527b6e7326c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleconditionparameters.go +++ /dev/null @@ -1,219 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeliveryRuleConditionParameters interface { - DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl -} - -var _ DeliveryRuleConditionParameters = BaseDeliveryRuleConditionParametersImpl{} - -type BaseDeliveryRuleConditionParametersImpl struct { - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s BaseDeliveryRuleConditionParametersImpl) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return s -} - -var _ DeliveryRuleConditionParameters = RawDeliveryRuleConditionParametersImpl{} - -// RawDeliveryRuleConditionParametersImpl is returned when the Discriminated Value doesn't match any of the defined types -// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) -// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). -type RawDeliveryRuleConditionParametersImpl struct { - deliveryRuleConditionParameters BaseDeliveryRuleConditionParametersImpl - Type string - Values map[string]interface{} -} - -func (s RawDeliveryRuleConditionParametersImpl) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return s.deliveryRuleConditionParameters -} - -func UnmarshalDeliveryRuleConditionParametersImplementation(input []byte) (DeliveryRuleConditionParameters, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleConditionParameters into map[string]interface: %+v", err) - } - - var value string - if v, ok := temp["typeName"]; ok { - value = fmt.Sprintf("%v", v) - } - - if strings.EqualFold(value, "DeliveryRuleClientPortConditionParameters") { - var out ClientPortMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ClientPortMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleCookiesConditionParameters") { - var out CookiesMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into CookiesMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleHttpVersionConditionParameters") { - var out HTTPVersionMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into HTTPVersionMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleHostNameConditionParameters") { - var out HostNameMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into HostNameMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleIsDeviceConditionParameters") { - var out IsDeviceMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into IsDeviceMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRulePostArgsConditionParameters") { - var out PostArgsMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into PostArgsMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleQueryStringConditionParameters") { - var out QueryStringMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into QueryStringMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleRemoteAddressConditionParameters") { - var out RemoteAddressMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RemoteAddressMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleRequestBodyConditionParameters") { - var out RequestBodyMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RequestBodyMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleRequestHeaderConditionParameters") { - var out RequestHeaderMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RequestHeaderMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleRequestMethodConditionParameters") { - var out RequestMethodMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RequestMethodMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleRequestSchemeConditionParameters") { - var out RequestSchemeMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RequestSchemeMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleRequestUriConditionParameters") { - var out RequestUriMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RequestUriMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleServerPortConditionParameters") { - var out ServerPortMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ServerPortMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleSocketAddrConditionParameters") { - var out SocketAddrMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into SocketAddrMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleSslProtocolConditionParameters") { - var out SslProtocolMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into SslProtocolMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleUrlFileExtensionMatchConditionParameters") { - var out URLFileExtensionMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into URLFileExtensionMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleUrlFilenameConditionParameters") { - var out URLFileNameMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into URLFileNameMatchConditionParameters: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DeliveryRuleUrlPathMatchConditionParameters") { - var out URLPathMatchConditionParameters - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into URLPathMatchConditionParameters: %+v", err) - } - return out, nil - } - - var parent BaseDeliveryRuleConditionParametersImpl - if err := json.Unmarshal(input, &parent); err != nil { - return nil, fmt.Errorf("unmarshaling into BaseDeliveryRuleConditionParametersImpl: %+v", err) - } - - return RawDeliveryRuleConditionParametersImpl{ - deliveryRuleConditionParameters: parent, - Type: value, - Values: temp, - }, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecookiescondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecookiescondition.go deleted file mode 100644 index e76520b53a28..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecookiescondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleCookiesCondition{} - -type DeliveryRuleCookiesCondition struct { - Parameters CookiesMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleCookiesCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleCookiesCondition{} - -func (s DeliveryRuleCookiesCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleCookiesCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleCookiesCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleCookiesCondition: %+v", err) - } - - decoded["name"] = "Cookies" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleCookiesCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehostnamecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehostnamecondition.go deleted file mode 100644 index 44ef6b50c1ea..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehostnamecondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleHostNameCondition{} - -type DeliveryRuleHostNameCondition struct { - Parameters HostNameMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleHostNameCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleHostNameCondition{} - -func (s DeliveryRuleHostNameCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleHostNameCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleHostNameCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleHostNameCondition: %+v", err) - } - - decoded["name"] = "HostName" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleHostNameCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehttpversioncondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehttpversioncondition.go deleted file mode 100644 index aa27793fbf21..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehttpversioncondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleHTTPVersionCondition{} - -type DeliveryRuleHTTPVersionCondition struct { - Parameters HTTPVersionMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleHTTPVersionCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleHTTPVersionCondition{} - -func (s DeliveryRuleHTTPVersionCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleHTTPVersionCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleHTTPVersionCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleHTTPVersionCondition: %+v", err) - } - - decoded["name"] = "HttpVersion" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleHTTPVersionCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleisdevicecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleisdevicecondition.go deleted file mode 100644 index 5ae76aaa26aa..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleisdevicecondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleIsDeviceCondition{} - -type DeliveryRuleIsDeviceCondition struct { - Parameters IsDeviceMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleIsDeviceCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleIsDeviceCondition{} - -func (s DeliveryRuleIsDeviceCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleIsDeviceCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleIsDeviceCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleIsDeviceCondition: %+v", err) - } - - decoded["name"] = "IsDevice" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleIsDeviceCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulepostargscondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulepostargscondition.go deleted file mode 100644 index 0b549f2b27b7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulepostargscondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRulePostArgsCondition{} - -type DeliveryRulePostArgsCondition struct { - Parameters PostArgsMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRulePostArgsCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRulePostArgsCondition{} - -func (s DeliveryRulePostArgsCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRulePostArgsCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRulePostArgsCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRulePostArgsCondition: %+v", err) - } - - decoded["name"] = "PostArgs" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRulePostArgsCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulequerystringcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulequerystringcondition.go deleted file mode 100644 index 8e147deab21d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulequerystringcondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleQueryStringCondition{} - -type DeliveryRuleQueryStringCondition struct { - Parameters QueryStringMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleQueryStringCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleQueryStringCondition{} - -func (s DeliveryRuleQueryStringCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleQueryStringCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleQueryStringCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleQueryStringCondition: %+v", err) - } - - decoded["name"] = "QueryString" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleQueryStringCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleremoteaddresscondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleremoteaddresscondition.go deleted file mode 100644 index 82eb3b6165d8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleremoteaddresscondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleRemoteAddressCondition{} - -type DeliveryRuleRemoteAddressCondition struct { - Parameters RemoteAddressMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleRemoteAddressCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleRemoteAddressCondition{} - -func (s DeliveryRuleRemoteAddressCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleRemoteAddressCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleRemoteAddressCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleRemoteAddressCondition: %+v", err) - } - - decoded["name"] = "RemoteAddress" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleRemoteAddressCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestbodycondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestbodycondition.go deleted file mode 100644 index 4a7ed969fdcd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestbodycondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleRequestBodyCondition{} - -type DeliveryRuleRequestBodyCondition struct { - Parameters RequestBodyMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleRequestBodyCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleRequestBodyCondition{} - -func (s DeliveryRuleRequestBodyCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleRequestBodyCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleRequestBodyCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestBodyCondition: %+v", err) - } - - decoded["name"] = "RequestBody" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestBodyCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheaderaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheaderaction.go deleted file mode 100644 index 0b4b70c1c740..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheaderaction.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleAction = DeliveryRuleRequestHeaderAction{} - -type DeliveryRuleRequestHeaderAction struct { - Parameters HeaderActionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleAction - - Name DeliveryRuleActionName `json:"name"` -} - -func (s DeliveryRuleRequestHeaderAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return BaseDeliveryRuleActionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleRequestHeaderAction{} - -func (s DeliveryRuleRequestHeaderAction) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleRequestHeaderAction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleRequestHeaderAction: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestHeaderAction: %+v", err) - } - - decoded["name"] = "ModifyRequestHeader" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestHeaderAction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheadercondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheadercondition.go deleted file mode 100644 index f1d34dc0f764..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheadercondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleRequestHeaderCondition{} - -type DeliveryRuleRequestHeaderCondition struct { - Parameters RequestHeaderMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleRequestHeaderCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleRequestHeaderCondition{} - -func (s DeliveryRuleRequestHeaderCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleRequestHeaderCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleRequestHeaderCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestHeaderCondition: %+v", err) - } - - decoded["name"] = "RequestHeader" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestHeaderCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestmethodcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestmethodcondition.go deleted file mode 100644 index 3ce8ced0d673..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestmethodcondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleRequestMethodCondition{} - -type DeliveryRuleRequestMethodCondition struct { - Parameters RequestMethodMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleRequestMethodCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleRequestMethodCondition{} - -func (s DeliveryRuleRequestMethodCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleRequestMethodCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleRequestMethodCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestMethodCondition: %+v", err) - } - - decoded["name"] = "RequestMethod" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestMethodCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestschemecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestschemecondition.go deleted file mode 100644 index 1af6289b7f06..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestschemecondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleRequestSchemeCondition{} - -type DeliveryRuleRequestSchemeCondition struct { - Parameters RequestSchemeMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleRequestSchemeCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleRequestSchemeCondition{} - -func (s DeliveryRuleRequestSchemeCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleRequestSchemeCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleRequestSchemeCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestSchemeCondition: %+v", err) - } - - decoded["name"] = "RequestScheme" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestSchemeCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequesturicondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequesturicondition.go deleted file mode 100644 index 63335243168b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequesturicondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleRequestUriCondition{} - -type DeliveryRuleRequestUriCondition struct { - Parameters RequestUriMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleRequestUriCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleRequestUriCondition{} - -func (s DeliveryRuleRequestUriCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleRequestUriCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleRequestUriCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleRequestUriCondition: %+v", err) - } - - decoded["name"] = "RequestUri" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleRequestUriCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleresponseheaderaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleresponseheaderaction.go deleted file mode 100644 index 264c599d00ab..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleresponseheaderaction.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleAction = DeliveryRuleResponseHeaderAction{} - -type DeliveryRuleResponseHeaderAction struct { - Parameters HeaderActionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleAction - - Name DeliveryRuleActionName `json:"name"` -} - -func (s DeliveryRuleResponseHeaderAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return BaseDeliveryRuleActionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleResponseHeaderAction{} - -func (s DeliveryRuleResponseHeaderAction) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleResponseHeaderAction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleResponseHeaderAction: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleResponseHeaderAction: %+v", err) - } - - decoded["name"] = "ModifyResponseHeader" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleResponseHeaderAction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go deleted file mode 100644 index 5aed6e8f9dc4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleAction = DeliveryRuleRouteConfigurationOverrideAction{} - -type DeliveryRuleRouteConfigurationOverrideAction struct { - Parameters RouteConfigurationOverrideActionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleAction - - Name DeliveryRuleActionName `json:"name"` -} - -func (s DeliveryRuleRouteConfigurationOverrideAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return BaseDeliveryRuleActionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleRouteConfigurationOverrideAction{} - -func (s DeliveryRuleRouteConfigurationOverrideAction) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleRouteConfigurationOverrideAction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleRouteConfigurationOverrideAction: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleRouteConfigurationOverrideAction: %+v", err) - } - - decoded["name"] = "RouteConfigurationOverride" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleRouteConfigurationOverrideAction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleserverportcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleserverportcondition.go deleted file mode 100644 index ce4318a26d08..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleserverportcondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleServerPortCondition{} - -type DeliveryRuleServerPortCondition struct { - Parameters ServerPortMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleServerPortCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleServerPortCondition{} - -func (s DeliveryRuleServerPortCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleServerPortCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleServerPortCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleServerPortCondition: %+v", err) - } - - decoded["name"] = "ServerPort" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleServerPortCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesocketaddrcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesocketaddrcondition.go deleted file mode 100644 index e7fab395f439..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesocketaddrcondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleSocketAddrCondition{} - -type DeliveryRuleSocketAddrCondition struct { - Parameters SocketAddrMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleSocketAddrCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleSocketAddrCondition{} - -func (s DeliveryRuleSocketAddrCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleSocketAddrCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleSocketAddrCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleSocketAddrCondition: %+v", err) - } - - decoded["name"] = "SocketAddr" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleSocketAddrCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesslprotocolcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesslprotocolcondition.go deleted file mode 100644 index 7ab504fa0544..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesslprotocolcondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleSslProtocolCondition{} - -type DeliveryRuleSslProtocolCondition struct { - Parameters SslProtocolMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleSslProtocolCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleSslProtocolCondition{} - -func (s DeliveryRuleSslProtocolCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleSslProtocolCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleSslProtocolCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleSslProtocolCondition: %+v", err) - } - - decoded["name"] = "SslProtocol" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleSslProtocolCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfileextensioncondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfileextensioncondition.go deleted file mode 100644 index 1654163eb0d9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfileextensioncondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleURLFileExtensionCondition{} - -type DeliveryRuleURLFileExtensionCondition struct { - Parameters URLFileExtensionMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleURLFileExtensionCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleURLFileExtensionCondition{} - -func (s DeliveryRuleURLFileExtensionCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleURLFileExtensionCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleURLFileExtensionCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleURLFileExtensionCondition: %+v", err) - } - - decoded["name"] = "UrlFileExtension" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleURLFileExtensionCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfilenamecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfilenamecondition.go deleted file mode 100644 index c2e66c272547..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfilenamecondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleURLFileNameCondition{} - -type DeliveryRuleURLFileNameCondition struct { - Parameters URLFileNameMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleURLFileNameCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleURLFileNameCondition{} - -func (s DeliveryRuleURLFileNameCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleURLFileNameCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleURLFileNameCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleURLFileNameCondition: %+v", err) - } - - decoded["name"] = "UrlFileName" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleURLFileNameCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlpathcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlpathcondition.go deleted file mode 100644 index f88fc78d5b0d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlpathcondition.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleCondition = DeliveryRuleURLPathCondition{} - -type DeliveryRuleURLPathCondition struct { - Parameters URLPathMatchConditionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleCondition - - Name MatchVariable `json:"name"` -} - -func (s DeliveryRuleURLPathCondition) DeliveryRuleCondition() BaseDeliveryRuleConditionImpl { - return BaseDeliveryRuleConditionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = DeliveryRuleURLPathCondition{} - -func (s DeliveryRuleURLPathCondition) MarshalJSON() ([]byte, error) { - type wrapper DeliveryRuleURLPathCondition - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DeliveryRuleURLPathCondition: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DeliveryRuleURLPathCondition: %+v", err) - } - - decoded["name"] = "UrlPath" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DeliveryRuleURLPathCondition: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_headeractionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_headeractionparameters.go deleted file mode 100644 index 6bf4a05fded9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_headeractionparameters.go +++ /dev/null @@ -1,52 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleActionParameters = HeaderActionParameters{} - -type HeaderActionParameters struct { - HeaderAction HeaderAction `json:"headerAction"` - HeaderName string `json:"headerName"` - Value *string `json:"value,omitempty"` - - // Fields inherited from DeliveryRuleActionParameters - - TypeName DeliveryRuleActionParametersType `json:"typeName"` -} - -func (s HeaderActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return BaseDeliveryRuleActionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = HeaderActionParameters{} - -func (s HeaderActionParameters) MarshalJSON() ([]byte, error) { - type wrapper HeaderActionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling HeaderActionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling HeaderActionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleHeaderActionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling HeaderActionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_hostnamematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_hostnamematchconditionparameters.go deleted file mode 100644 index 9dde99c7f84f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_hostnamematchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = HostNameMatchConditionParameters{} - -type HostNameMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator HostNameOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s HostNameMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = HostNameMatchConditionParameters{} - -func (s HostNameMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper HostNameMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling HostNameMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling HostNameMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleHostNameConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling HostNameMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_httpversionmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_httpversionmatchconditionparameters.go deleted file mode 100644 index 4fdfdc7344d1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_httpversionmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = HTTPVersionMatchConditionParameters{} - -type HTTPVersionMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator HTTPVersionOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s HTTPVersionMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = HTTPVersionMatchConditionParameters{} - -func (s HTTPVersionMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper HTTPVersionMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling HTTPVersionMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling HTTPVersionMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleHttpVersionConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling HTTPVersionMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_isdevicematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_isdevicematchconditionparameters.go deleted file mode 100644 index f3b7e28c6bce..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_isdevicematchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = IsDeviceMatchConditionParameters{} - -type IsDeviceMatchConditionParameters struct { - MatchValues *[]IsDeviceMatchValue `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator IsDeviceOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s IsDeviceMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = IsDeviceMatchConditionParameters{} - -func (s IsDeviceMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper IsDeviceMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling IsDeviceMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling IsDeviceMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleIsDeviceConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling IsDeviceMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverride.go deleted file mode 100644 index 72d2e00784bc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverride.go +++ /dev/null @@ -1,9 +0,0 @@ -package rules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type OriginGroupOverride struct { - ForwardingProtocol *ForwardingProtocol `json:"forwardingProtocol,omitempty"` - OriginGroup *ResourceReference `json:"originGroup,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideaction.go deleted file mode 100644 index d7ed168c94c2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideaction.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleAction = OriginGroupOverrideAction{} - -type OriginGroupOverrideAction struct { - Parameters OriginGroupOverrideActionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleAction - - Name DeliveryRuleActionName `json:"name"` -} - -func (s OriginGroupOverrideAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return BaseDeliveryRuleActionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = OriginGroupOverrideAction{} - -func (s OriginGroupOverrideAction) MarshalJSON() ([]byte, error) { - type wrapper OriginGroupOverrideAction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling OriginGroupOverrideAction: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling OriginGroupOverrideAction: %+v", err) - } - - decoded["name"] = "OriginGroupOverride" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling OriginGroupOverrideAction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideactionparameters.go deleted file mode 100644 index 138ece4ddeae..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideactionparameters.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleActionParameters = OriginGroupOverrideActionParameters{} - -type OriginGroupOverrideActionParameters struct { - OriginGroup ResourceReference `json:"originGroup"` - - // Fields inherited from DeliveryRuleActionParameters - - TypeName DeliveryRuleActionParametersType `json:"typeName"` -} - -func (s OriginGroupOverrideActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return BaseDeliveryRuleActionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = OriginGroupOverrideActionParameters{} - -func (s OriginGroupOverrideActionParameters) MarshalJSON() ([]byte, error) { - type wrapper OriginGroupOverrideActionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling OriginGroupOverrideActionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling OriginGroupOverrideActionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleOriginGroupOverrideActionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling OriginGroupOverrideActionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_postargsmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_postargsmatchconditionparameters.go deleted file mode 100644 index 3943de4a654e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_postargsmatchconditionparameters.go +++ /dev/null @@ -1,54 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = PostArgsMatchConditionParameters{} - -type PostArgsMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator PostArgsOperator `json:"operator"` - Selector *string `json:"selector,omitempty"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s PostArgsMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = PostArgsMatchConditionParameters{} - -func (s PostArgsMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper PostArgsMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling PostArgsMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling PostArgsMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRulePostArgsConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling PostArgsMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_querystringmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_querystringmatchconditionparameters.go deleted file mode 100644 index 6e8d907688bf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_querystringmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = QueryStringMatchConditionParameters{} - -type QueryStringMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator QueryStringOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s QueryStringMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = QueryStringMatchConditionParameters{} - -func (s QueryStringMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper QueryStringMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling QueryStringMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling QueryStringMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleQueryStringConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling QueryStringMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_remoteaddressmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_remoteaddressmatchconditionparameters.go deleted file mode 100644 index 9e91456eb105..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_remoteaddressmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = RemoteAddressMatchConditionParameters{} - -type RemoteAddressMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator RemoteAddressOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s RemoteAddressMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = RemoteAddressMatchConditionParameters{} - -func (s RemoteAddressMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper RemoteAddressMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RemoteAddressMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RemoteAddressMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleRemoteAddressConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RemoteAddressMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestbodymatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestbodymatchconditionparameters.go deleted file mode 100644 index 6264e1db154f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestbodymatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = RequestBodyMatchConditionParameters{} - -type RequestBodyMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator RequestBodyOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s RequestBodyMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = RequestBodyMatchConditionParameters{} - -func (s RequestBodyMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper RequestBodyMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RequestBodyMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RequestBodyMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleRequestBodyConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RequestBodyMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestheadermatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestheadermatchconditionparameters.go deleted file mode 100644 index 8f2ca7a33d86..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestheadermatchconditionparameters.go +++ /dev/null @@ -1,54 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = RequestHeaderMatchConditionParameters{} - -type RequestHeaderMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator RequestHeaderOperator `json:"operator"` - Selector *string `json:"selector,omitempty"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s RequestHeaderMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = RequestHeaderMatchConditionParameters{} - -func (s RequestHeaderMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper RequestHeaderMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RequestHeaderMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RequestHeaderMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleRequestHeaderConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RequestHeaderMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestmethodmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestmethodmatchconditionparameters.go deleted file mode 100644 index ea18f9eab27b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestmethodmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = RequestMethodMatchConditionParameters{} - -type RequestMethodMatchConditionParameters struct { - MatchValues *[]RequestMethodMatchValue `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator RequestMethodOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s RequestMethodMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = RequestMethodMatchConditionParameters{} - -func (s RequestMethodMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper RequestMethodMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RequestMethodMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RequestMethodMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleRequestMethodConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RequestMethodMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestschemematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestschemematchconditionparameters.go deleted file mode 100644 index 6e69c0badcec..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestschemematchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = RequestSchemeMatchConditionParameters{} - -type RequestSchemeMatchConditionParameters struct { - MatchValues *[]RequestSchemeMatchValue `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator Operator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s RequestSchemeMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = RequestSchemeMatchConditionParameters{} - -func (s RequestSchemeMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper RequestSchemeMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RequestSchemeMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RequestSchemeMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleRequestSchemeConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RequestSchemeMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requesturimatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requesturimatchconditionparameters.go deleted file mode 100644 index 72fcf177b2d4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requesturimatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = RequestUriMatchConditionParameters{} - -type RequestUriMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator RequestUriOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s RequestUriMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = RequestUriMatchConditionParameters{} - -func (s RequestUriMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper RequestUriMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RequestUriMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RequestUriMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleRequestUriConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RequestUriMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_resourcereference.go deleted file mode 100644 index 841c18a07708..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_resourcereference.go +++ /dev/null @@ -1,8 +0,0 @@ -package rules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ResourceReference struct { - Id *string `json:"id,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_routeconfigurationoverrideactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_routeconfigurationoverrideactionparameters.go deleted file mode 100644 index 39b23f835a56..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_routeconfigurationoverrideactionparameters.go +++ /dev/null @@ -1,51 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleActionParameters = RouteConfigurationOverrideActionParameters{} - -type RouteConfigurationOverrideActionParameters struct { - CacheConfiguration *CacheConfiguration `json:"cacheConfiguration,omitempty"` - OriginGroupOverride *OriginGroupOverride `json:"originGroupOverride,omitempty"` - - // Fields inherited from DeliveryRuleActionParameters - - TypeName DeliveryRuleActionParametersType `json:"typeName"` -} - -func (s RouteConfigurationOverrideActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return BaseDeliveryRuleActionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = RouteConfigurationOverrideActionParameters{} - -func (s RouteConfigurationOverrideActionParameters) MarshalJSON() ([]byte, error) { - type wrapper RouteConfigurationOverrideActionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RouteConfigurationOverrideActionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RouteConfigurationOverrideActionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleRouteConfigurationOverrideActionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RouteConfigurationOverrideActionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_rule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_rule.go deleted file mode 100644 index 8b9504ed6008..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_rule.go +++ /dev/null @@ -1,16 +0,0 @@ -package rules - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Rule struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *RuleProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleproperties.go deleted file mode 100644 index f9405db82fe5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleproperties.go +++ /dev/null @@ -1,81 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RuleProperties struct { - Actions *[]DeliveryRuleAction `json:"actions,omitempty"` - Conditions *[]DeliveryRuleCondition `json:"conditions,omitempty"` - DeploymentStatus *DeploymentStatus `json:"deploymentStatus,omitempty"` - MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` - Order *int64 `json:"order,omitempty"` - ProvisioningState *AfdProvisioningState `json:"provisioningState,omitempty"` - RuleSetName *string `json:"ruleSetName,omitempty"` -} - -var _ json.Unmarshaler = &RuleProperties{} - -func (s *RuleProperties) UnmarshalJSON(bytes []byte) error { - var decoded struct { - DeploymentStatus *DeploymentStatus `json:"deploymentStatus,omitempty"` - MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` - Order *int64 `json:"order,omitempty"` - ProvisioningState *AfdProvisioningState `json:"provisioningState,omitempty"` - RuleSetName *string `json:"ruleSetName,omitempty"` - } - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - - s.DeploymentStatus = decoded.DeploymentStatus - s.MatchProcessingBehavior = decoded.MatchProcessingBehavior - s.Order = decoded.Order - s.ProvisioningState = decoded.ProvisioningState - s.RuleSetName = decoded.RuleSetName - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling RuleProperties into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["actions"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Actions into list []json.RawMessage: %+v", err) - } - - output := make([]DeliveryRuleAction, 0) - for i, val := range listTemp { - impl, err := UnmarshalDeliveryRuleActionImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Actions' for 'RuleProperties': %+v", i, err) - } - output = append(output, impl) - } - s.Actions = &output - } - - if v, ok := temp["conditions"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Conditions into list []json.RawMessage: %+v", err) - } - - output := make([]DeliveryRuleCondition, 0) - for i, val := range listTemp { - impl, err := UnmarshalDeliveryRuleConditionImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Conditions' for 'RuleProperties': %+v", i, err) - } - output = append(output, impl) - } - s.Conditions = &output - } - - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdateparameters.go deleted file mode 100644 index d5bd427fc3d7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdateparameters.go +++ /dev/null @@ -1,8 +0,0 @@ -package rules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RuleUpdateParameters struct { - Properties *RuleUpdatePropertiesParameters `json:"properties,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdatepropertiesparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdatepropertiesparameters.go deleted file mode 100644 index 3403d24408de..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdatepropertiesparameters.go +++ /dev/null @@ -1,75 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RuleUpdatePropertiesParameters struct { - Actions *[]DeliveryRuleAction `json:"actions,omitempty"` - Conditions *[]DeliveryRuleCondition `json:"conditions,omitempty"` - MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` - Order *int64 `json:"order,omitempty"` - RuleSetName *string `json:"ruleSetName,omitempty"` -} - -var _ json.Unmarshaler = &RuleUpdatePropertiesParameters{} - -func (s *RuleUpdatePropertiesParameters) UnmarshalJSON(bytes []byte) error { - var decoded struct { - MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` - Order *int64 `json:"order,omitempty"` - RuleSetName *string `json:"ruleSetName,omitempty"` - } - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - - s.MatchProcessingBehavior = decoded.MatchProcessingBehavior - s.Order = decoded.Order - s.RuleSetName = decoded.RuleSetName - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling RuleUpdatePropertiesParameters into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["actions"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Actions into list []json.RawMessage: %+v", err) - } - - output := make([]DeliveryRuleAction, 0) - for i, val := range listTemp { - impl, err := UnmarshalDeliveryRuleActionImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Actions' for 'RuleUpdatePropertiesParameters': %+v", i, err) - } - output = append(output, impl) - } - s.Actions = &output - } - - if v, ok := temp["conditions"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Conditions into list []json.RawMessage: %+v", err) - } - - output := make([]DeliveryRuleCondition, 0) - for i, val := range listTemp { - impl, err := UnmarshalDeliveryRuleConditionImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Conditions' for 'RuleUpdatePropertiesParameters': %+v", i, err) - } - output = append(output, impl) - } - s.Conditions = &output - } - - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_serverportmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_serverportmatchconditionparameters.go deleted file mode 100644 index 8f96177dbcb5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_serverportmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = ServerPortMatchConditionParameters{} - -type ServerPortMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator ServerPortOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s ServerPortMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = ServerPortMatchConditionParameters{} - -func (s ServerPortMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper ServerPortMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ServerPortMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ServerPortMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleServerPortConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ServerPortMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_socketaddrmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_socketaddrmatchconditionparameters.go deleted file mode 100644 index c5056b07bd93..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_socketaddrmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = SocketAddrMatchConditionParameters{} - -type SocketAddrMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator SocketAddrOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s SocketAddrMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = SocketAddrMatchConditionParameters{} - -func (s SocketAddrMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper SocketAddrMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling SocketAddrMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling SocketAddrMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleSocketAddrConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling SocketAddrMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_sslprotocolmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_sslprotocolmatchconditionparameters.go deleted file mode 100644 index e424bb27aaf5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_sslprotocolmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = SslProtocolMatchConditionParameters{} - -type SslProtocolMatchConditionParameters struct { - MatchValues *[]SslProtocol `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator SslProtocolOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s SslProtocolMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = SslProtocolMatchConditionParameters{} - -func (s SslProtocolMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper SslProtocolMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling SslProtocolMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling SslProtocolMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleSslProtocolConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling SslProtocolMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfileextensionmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfileextensionmatchconditionparameters.go deleted file mode 100644 index 275ca468b7ad..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfileextensionmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = URLFileExtensionMatchConditionParameters{} - -type URLFileExtensionMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator URLFileExtensionOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s URLFileExtensionMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = URLFileExtensionMatchConditionParameters{} - -func (s URLFileExtensionMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper URLFileExtensionMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling URLFileExtensionMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling URLFileExtensionMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleUrlFileExtensionMatchConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling URLFileExtensionMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfilenamematchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfilenamematchconditionparameters.go deleted file mode 100644 index 5d6316c6493f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfilenamematchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = URLFileNameMatchConditionParameters{} - -type URLFileNameMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator URLFileNameOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s URLFileNameMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = URLFileNameMatchConditionParameters{} - -func (s URLFileNameMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper URLFileNameMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling URLFileNameMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling URLFileNameMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleUrlFilenameConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling URLFileNameMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlpathmatchconditionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlpathmatchconditionparameters.go deleted file mode 100644 index e62c36d355c5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlpathmatchconditionparameters.go +++ /dev/null @@ -1,53 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleConditionParameters = URLPathMatchConditionParameters{} - -type URLPathMatchConditionParameters struct { - MatchValues *[]string `json:"matchValues,omitempty"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator URLPathOperator `json:"operator"` - Transforms *[]Transform `json:"transforms,omitempty"` - - // Fields inherited from DeliveryRuleConditionParameters - - TypeName DeliveryRuleConditionParametersType `json:"typeName"` -} - -func (s URLPathMatchConditionParameters) DeliveryRuleConditionParameters() BaseDeliveryRuleConditionParametersImpl { - return BaseDeliveryRuleConditionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = URLPathMatchConditionParameters{} - -func (s URLPathMatchConditionParameters) MarshalJSON() ([]byte, error) { - type wrapper URLPathMatchConditionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling URLPathMatchConditionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling URLPathMatchConditionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleUrlPathMatchConditionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling URLPathMatchConditionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectaction.go deleted file mode 100644 index 578a809c1593..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectaction.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleAction = URLRedirectAction{} - -type URLRedirectAction struct { - Parameters URLRedirectActionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleAction - - Name DeliveryRuleActionName `json:"name"` -} - -func (s URLRedirectAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return BaseDeliveryRuleActionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = URLRedirectAction{} - -func (s URLRedirectAction) MarshalJSON() ([]byte, error) { - type wrapper URLRedirectAction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling URLRedirectAction: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling URLRedirectAction: %+v", err) - } - - decoded["name"] = "UrlRedirect" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling URLRedirectAction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectactionparameters.go deleted file mode 100644 index e9f8a9a7ada1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectactionparameters.go +++ /dev/null @@ -1,55 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleActionParameters = URLRedirectActionParameters{} - -type URLRedirectActionParameters struct { - CustomFragment *string `json:"customFragment,omitempty"` - CustomHostname *string `json:"customHostname,omitempty"` - CustomPath *string `json:"customPath,omitempty"` - CustomQueryString *string `json:"customQueryString,omitempty"` - DestinationProtocol *DestinationProtocol `json:"destinationProtocol,omitempty"` - RedirectType RedirectType `json:"redirectType"` - - // Fields inherited from DeliveryRuleActionParameters - - TypeName DeliveryRuleActionParametersType `json:"typeName"` -} - -func (s URLRedirectActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return BaseDeliveryRuleActionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = URLRedirectActionParameters{} - -func (s URLRedirectActionParameters) MarshalJSON() ([]byte, error) { - type wrapper URLRedirectActionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling URLRedirectActionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling URLRedirectActionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleUrlRedirectActionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling URLRedirectActionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteaction.go deleted file mode 100644 index a8b1e21014c1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteaction.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleAction = URLRewriteAction{} - -type URLRewriteAction struct { - Parameters URLRewriteActionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleAction - - Name DeliveryRuleActionName `json:"name"` -} - -func (s URLRewriteAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return BaseDeliveryRuleActionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = URLRewriteAction{} - -func (s URLRewriteAction) MarshalJSON() ([]byte, error) { - type wrapper URLRewriteAction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling URLRewriteAction: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling URLRewriteAction: %+v", err) - } - - decoded["name"] = "UrlRewrite" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling URLRewriteAction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteactionparameters.go deleted file mode 100644 index e142109b4259..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteactionparameters.go +++ /dev/null @@ -1,52 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleActionParameters = URLRewriteActionParameters{} - -type URLRewriteActionParameters struct { - Destination string `json:"destination"` - PreserveUnmatchedPath *bool `json:"preserveUnmatchedPath,omitempty"` - SourcePattern string `json:"sourcePattern"` - - // Fields inherited from DeliveryRuleActionParameters - - TypeName DeliveryRuleActionParametersType `json:"typeName"` -} - -func (s URLRewriteActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return BaseDeliveryRuleActionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = URLRewriteActionParameters{} - -func (s URLRewriteActionParameters) MarshalJSON() ([]byte, error) { - type wrapper URLRewriteActionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling URLRewriteActionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling URLRewriteActionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleUrlRewriteActionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling URLRewriteActionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningaction.go deleted file mode 100644 index 7d5cb1faa224..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningaction.go +++ /dev/null @@ -1,50 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleAction = URLSigningAction{} - -type URLSigningAction struct { - Parameters URLSigningActionParameters `json:"parameters"` - - // Fields inherited from DeliveryRuleAction - - Name DeliveryRuleActionName `json:"name"` -} - -func (s URLSigningAction) DeliveryRuleAction() BaseDeliveryRuleActionImpl { - return BaseDeliveryRuleActionImpl{ - Name: s.Name, - } -} - -var _ json.Marshaler = URLSigningAction{} - -func (s URLSigningAction) MarshalJSON() ([]byte, error) { - type wrapper URLSigningAction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling URLSigningAction: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling URLSigningAction: %+v", err) - } - - decoded["name"] = "UrlSigning" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling URLSigningAction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningactionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningactionparameters.go deleted file mode 100644 index 787ca3ac7c11..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningactionparameters.go +++ /dev/null @@ -1,51 +0,0 @@ -package rules - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ DeliveryRuleActionParameters = URLSigningActionParameters{} - -type URLSigningActionParameters struct { - Algorithm *Algorithm `json:"algorithm,omitempty"` - ParameterNameOverride *[]URLSigningParamIdentifier `json:"parameterNameOverride,omitempty"` - - // Fields inherited from DeliveryRuleActionParameters - - TypeName DeliveryRuleActionParametersType `json:"typeName"` -} - -func (s URLSigningActionParameters) DeliveryRuleActionParameters() BaseDeliveryRuleActionParametersImpl { - return BaseDeliveryRuleActionParametersImpl{ - TypeName: s.TypeName, - } -} - -var _ json.Marshaler = URLSigningActionParameters{} - -func (s URLSigningActionParameters) MarshalJSON() ([]byte, error) { - type wrapper URLSigningActionParameters - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling URLSigningActionParameters: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling URLSigningActionParameters: %+v", err) - } - - decoded["typeName"] = "DeliveryRuleUrlSigningActionParameters" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling URLSigningActionParameters: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningparamidentifier.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningparamidentifier.go deleted file mode 100644 index 6b81c77c9b8c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningparamidentifier.go +++ /dev/null @@ -1,9 +0,0 @@ -package rules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type URLSigningParamIdentifier struct { - ParamIndicator ParamIndicator `json:"paramIndicator"` - ParamName string `json:"paramName"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/predicates.go deleted file mode 100644 index 0dd99d7ba7d0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/predicates.go +++ /dev/null @@ -1,27 +0,0 @@ -package rules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RuleOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p RuleOperationPredicate) Matches(input Rule) bool { - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/version.go deleted file mode 100644 index 92f94359d2cf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/version.go +++ /dev/null @@ -1,10 +0,0 @@ -package rules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2024-09-01" - -func userAgent() string { - return "hashicorp/go-azure-sdk/rules/2024-09-01" -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 797e52a2a720..4a42ef8f06d6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -315,7 +315,6 @@ 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 github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes From 4aeb972b134be22d7edf1888f5b338e829f5f4f7 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Thu, 30 Jan 2025 17:23:13 -0700 Subject: [PATCH 06/17] Fix lint errors... --- .../cdn/cdn_frontdoor_rule_resource.go | 4 - .../cdn_frontdoor_rule_actions.go | 52 ++++++------- .../cdn_frontdoor_rule_conditions.go | 74 +++++-------------- 3 files changed, 40 insertions(+), 90 deletions(-) diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource.go b/internal/services/cdn/cdn_frontdoor_rule_resource.go index e5b942e4507f..144bdbb44d9d 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource.go @@ -688,7 +688,6 @@ func resourceCdnFrontDoorRuleRead(d *pluginsdk.ResourceData, meta interface{}) e } if model := result.Model; model != nil { - if props := model.Properties; props != nil { d.Set("name", id.RuleName) d.Set("cdn_frontdoor_rule_set_id", ruleSet.ID()) @@ -925,7 +924,6 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition // input here is the base wrapper object that has all of the data from the model... for _, deliveryRuleCondition := range *input { - if deliveryRuleCondition.DeliveryRuleCondition().Name == c.ClientPort.Name { condition := deliveryRuleCondition.(rules.DeliveryRuleClientPortCondition) @@ -972,7 +970,6 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition httpVersionCondition = append(httpVersionCondition, flattened) continue - } if deliveryRuleCondition.DeliveryRuleCondition().Name == c.IsDevice.Name { @@ -1021,7 +1018,6 @@ func flattenFrontdoorDeliveryRuleConditions(input *[]rules.DeliveryRuleCondition remoteAddressCondition = append(remoteAddressCondition, flattened) continue - } if deliveryRuleCondition.DeliveryRuleCondition().Name == c.RequestBody.Name { diff --git a/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go b/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go index 99c5937e50dd..cfccbca48df8 100644 --- a/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go +++ b/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go @@ -321,13 +321,11 @@ func ExpandCdnFrontDoorRouteConfigurationOverrideAction(input []interface{}) (*[ } func FlattenRequestHeaderAction(input rules.DeliveryRuleRequestHeaderAction) map[string]interface{} { - action := "" - name := "" - value := "" + var value string params := input.Parameters - action = string(params.HeaderAction) - name = params.HeaderName + action := string(params.HeaderAction) + name := params.HeaderName if params.Value != nil { value = *params.Value @@ -341,13 +339,11 @@ func FlattenRequestHeaderAction(input rules.DeliveryRuleRequestHeaderAction) map } func FlattenResponseHeaderAction(input rules.DeliveryRuleResponseHeaderAction) map[string]interface{} { - action := "" - name := "" - value := "" + var value string params := input.Parameters - action = string(params.HeaderAction) - name = params.HeaderName + action := string(params.HeaderAction) + name := params.HeaderName if params.Value != nil { value = *params.Value @@ -361,12 +357,10 @@ func FlattenResponseHeaderAction(input rules.DeliveryRuleResponseHeaderAction) m } func FlattenCdnFrontDoorUrlRedirectAction(input rules.URLRedirectAction) map[string]interface{} { - destinationHost := "" - destinationPath := "" - queryString := "" - destinationProtocol := "" - redirectType := "" - fragment := "" + var destinationHost string + var destinationPath string + var queryString string + var fragment string params := input.Parameters @@ -380,8 +374,8 @@ func FlattenCdnFrontDoorUrlRedirectAction(input rules.URLRedirectAction) map[str queryString = *params.CustomQueryString } - destinationProtocol = string(pointer.From(params.DestinationProtocol)) - redirectType = string(params.RedirectType) + destinationProtocol := string(pointer.From(params.DestinationProtocol)) + redirectType := string(params.RedirectType) if params.CustomFragment != nil { fragment = *params.CustomFragment @@ -398,15 +392,11 @@ func FlattenCdnFrontDoorUrlRedirectAction(input rules.URLRedirectAction) map[str } func FlattenCdnFrontDoorUrlRewriteAction(input rules.URLRewriteAction) map[string]interface{} { - destination := "" - preservePath := false - sourcePattern := "" - params := input.Parameters - destination = params.Destination - preservePath = *params.PreserveUnmatchedPath - sourcePattern = params.SourcePattern + destination := params.Destination + preservePath := *params.PreserveUnmatchedPath + sourcePattern := params.SourcePattern return map[string]interface{}{ "destination": destination, @@ -416,13 +406,13 @@ func FlattenCdnFrontDoorUrlRewriteAction(input rules.URLRewriteAction) map[strin } func FlattenCdnFrontDoorRouteConfigurationOverrideAction(input rules.DeliveryRuleRouteConfigurationOverrideAction) (map[string]interface{}, error) { - queryStringCachingBehavior := "" - cacheBehavior := "" - compressionEnabled := false - cacheDuration := "" + var queryStringCachingBehavior string + var cacheBehavior string + var compressionEnabled bool + var cacheDuration string + var forwardingProtocol string + var originGroupId string queryParameters := make([]interface{}, 0) - forwardingProtocol := "" - originGroupId := "" params := input.Parameters diff --git a/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go b/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go index 8374423646b4..55e59fc69fad 100644 --- a/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go +++ b/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go @@ -882,10 +882,9 @@ func ExpandCdnFrontDoorSslProtocolCondition(input []interface{}) (*[]rules.Deliv } func FlattenFrontdoorRemoteAddressCondition(input rules.DeliveryRuleRemoteAddressCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -897,10 +896,9 @@ func FlattenFrontdoorRemoteAddressCondition(input rules.DeliveryRuleRemoteAddres } func FlattenFrontdoorRequestMethodCondition(input rules.DeliveryRuleRequestMethodCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -912,10 +910,9 @@ func FlattenFrontdoorRequestMethodCondition(input rules.DeliveryRuleRequestMetho } func FlattenFrontdoorQueryStringCondition(input rules.DeliveryRuleQueryStringCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -927,10 +924,9 @@ func FlattenFrontdoorQueryStringCondition(input rules.DeliveryRuleQueryStringCon } func FlattenFrontdoorPostArgsCondition(input rules.DeliveryRulePostArgsCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: &normalizedSelector{name: pointer.To("post_args_name"), value: params.Selector}, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -942,10 +938,9 @@ func FlattenFrontdoorPostArgsCondition(input rules.DeliveryRulePostArgsCondition } func FlattenFrontdoorRequestUriCondition(input rules.DeliveryRuleRequestUriCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -957,10 +952,9 @@ func FlattenFrontdoorRequestUriCondition(input rules.DeliveryRuleRequestUriCondi } func FlattenFrontdoorRequestHeaderCondition(input rules.DeliveryRuleRequestHeaderCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: &normalizedSelector{name: pointer.To("header_name"), value: params.Selector}, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -972,10 +966,9 @@ func FlattenFrontdoorRequestHeaderCondition(input rules.DeliveryRuleRequestHeade } func FlattenFrontdoorRequestBodyCondition(input rules.DeliveryRuleRequestBodyCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -987,10 +980,9 @@ func FlattenFrontdoorRequestBodyCondition(input rules.DeliveryRuleRequestBodyCon } func FlattenFrontdoorRequestSchemeCondition(input rules.DeliveryRuleRequestSchemeCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1002,10 +994,9 @@ func FlattenFrontdoorRequestSchemeCondition(input rules.DeliveryRuleRequestSchem } func FlattenFrontdoorUrlPathCondition(input rules.DeliveryRuleURLPathCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1017,10 +1008,9 @@ func FlattenFrontdoorUrlPathCondition(input rules.DeliveryRuleURLPathCondition) } func FlattenFrontdoorUrlFileExtensionCondition(input rules.DeliveryRuleURLFileExtensionCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1032,10 +1022,9 @@ func FlattenFrontdoorUrlFileExtensionCondition(input rules.DeliveryRuleURLFileEx } func FlattenFrontdoorUrlFileNameCondition(input rules.DeliveryRuleURLFileNameCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1047,10 +1036,9 @@ func FlattenFrontdoorUrlFileNameCondition(input rules.DeliveryRuleURLFileNameCon } func FlattenFrontdoorHttpVersionCondition(input rules.DeliveryRuleHTTPVersionCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1062,11 +1050,9 @@ func FlattenFrontdoorHttpVersionCondition(input rules.DeliveryRuleHTTPVersionCon } func FlattenFrontdoorCookiesCondition(input rules.DeliveryRuleCookiesCondition) (map[string]interface{}, error) { - // create a normalized condition stub first with empty values so we can push that to the state file - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: &normalizedSelector{name: pointer.To("cookie_name"), value: params.Selector}, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1079,10 +1065,9 @@ func FlattenFrontdoorCookiesCondition(input rules.DeliveryRuleCookiesCondition) } func FlattenFrontdoorIsDeviceCondition(input rules.DeliveryRuleIsDeviceCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1094,10 +1079,9 @@ func FlattenFrontdoorIsDeviceCondition(input rules.DeliveryRuleIsDeviceCondition } func FlattenFrontdoorSocketAddressCondition(input rules.DeliveryRuleSocketAddrCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1109,10 +1093,9 @@ func FlattenFrontdoorSocketAddressCondition(input rules.DeliveryRuleSocketAddrCo } func FlattenFrontdoorClientPortCondition(input rules.DeliveryRuleClientPortCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1124,10 +1107,9 @@ func FlattenFrontdoorClientPortCondition(input rules.DeliveryRuleClientPortCondi } func FlattenFrontdoorServerPortCondition(input rules.DeliveryRuleServerPortCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1139,10 +1121,9 @@ func FlattenFrontdoorServerPortCondition(input rules.DeliveryRuleServerPortCondi } func FlattenFrontdoorHostNameCondition(input rules.DeliveryRuleHostNameCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1154,7 +1135,6 @@ func FlattenFrontdoorHostNameCondition(input rules.DeliveryRuleHostNameCondition } func FlattenFrontdoorSslProtocolCondition(input rules.DeliveryRuleSslProtocolCondition) (map[string]interface{}, error) { - normalized := createCdnFrontDoorNormalizedConditionStub() params := input.Parameters matchValues := make([]string, 0) @@ -1162,7 +1142,7 @@ func FlattenFrontdoorSslProtocolCondition(input rules.DeliveryRuleSslProtocolCon matchValues = append(matchValues, string(value)) } - normalized = normalizedCondition{ + normalized := normalizedCondition{ selector: nil, operator: string(params.Operator), negateCondition: params.NegateCondition, @@ -1173,22 +1153,6 @@ func FlattenFrontdoorSslProtocolCondition(input rules.DeliveryRuleSslProtocolCon return flattenCdnFrontDoorNormalizedCondition(normalized), nil } -func createCdnFrontDoorNormalizedConditionStub() normalizedCondition { - matchValues := make([]string, 0) - - stub := normalizedCondition{ - selector: nil, - operator: "", - 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 { From ab385a03aae7021320a4403a55488df5c89e7d42 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Thu, 30 Jan 2025 20:37:42 -0700 Subject: [PATCH 07/17] Fix RuleSet Client... --- internal/services/cdn/client/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/cdn/client/client.go b/internal/services/cdn/client/client.go index 37a21d8afd61..1a651e3263e8 100644 --- a/internal/services/cdn/client/client.go +++ b/internal/services/cdn/client/client.go @@ -82,7 +82,7 @@ func NewClient(o *common.ClientOptions) (*Client, error) { if err != nil { return nil, fmt.Errorf("building RuleSet: %+v", err) } - o.Configure(frontDoorRulesClient.Client, o.Authorizers.ResourceManager) + o.Configure(frontDoorRuleSetsClient.Client, o.Authorizers.ResourceManager) customDomainsClient := cdnSdk.NewCustomDomainsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&customDomainsClient.Client, o.ResourceManagerAuthorizer) From 5c42bba04200bd0b69818df37a1ab7de3d93e905 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Fri, 31 Jan 2025 00:25:04 -0700 Subject: [PATCH 08/17] Add JSChallenge functionality for the override action type... --- .../cdn_frontdoor_firewall_policy_resource.go | 24 +-- ...frontdoor_firewall_policy_resource_test.go | 161 +++++++++++++++++- internal/services/cdn/client/client.go | 62 +++---- ...dn_frontdoor_firewall_policy.html.markdown | 16 +- 4 files changed, 202 insertions(+), 61 deletions(-) diff --git a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go index 4b295ce41af5..46c85edbfa67 100644 --- a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go +++ b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go @@ -6,6 +6,7 @@ package cdn import ( "fmt" "strconv" + "strings" "time" "github.com/hashicorp/go-azure-helpers/lang/pointer" @@ -419,16 +420,13 @@ func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { }, }, + // NOTE: 'ActionTypeAnomalyScoring' is only valid with 2.0 and above + // 'ActionTypeJSChallenge' is only valid with BotManagerRuleSets "action": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(waf.ActionTypeAllow), - string(waf.ActionTypeLog), - string(waf.ActionTypeBlock), - string(waf.ActionTypeRedirect), - string(waf.ActionTypeAnomalyScoring), // Only valid with 2.0 and above - }, false), + ValidateFunc: validation.StringInSlice(waf.PossibleValuesForActionType(), + false), }, }, }, @@ -826,7 +824,7 @@ func expandCdnFrontDoorFirewallManagedRules(input []interface{}) (*waf.ManagedRu return nil, fmt.Errorf("the managed rule set type %q and version %q is not supported. If you wish to use the 'Microsoft_DefaultRuleSet' type please update your 'version' field to be '1.1', '2.0' or '2.1', got %q", ruleType, version, version) } - ruleGroupOverrides, err := expandCdnFrontDoorFirewallManagedRuleGroupOverride(overrides, version, fVersion) + ruleGroupOverrides, err := expandCdnFrontDoorFirewallManagedRuleGroupOverride(overrides, version, fVersion, ruleType) if err != nil { return nil, err } @@ -873,7 +871,7 @@ func expandCdnFrontDoorFirewallManagedRuleGroupExclusion(input []interface{}) *[ return &results } -func expandCdnFrontDoorFirewallManagedRuleGroupOverride(input []interface{}, versionRaw string, version float64) (*[]waf.ManagedRuleGroupOverride, error) { +func expandCdnFrontDoorFirewallManagedRuleGroupOverride(input []interface{}, versionRaw string, version float64, ruleType string) (*[]waf.ManagedRuleGroupOverride, error) { result := make([]waf.ManagedRuleGroupOverride, 0) if len(input) == 0 { return nil, nil @@ -884,7 +882,7 @@ func expandCdnFrontDoorFirewallManagedRuleGroupOverride(input []interface{}, ver exclusions := expandCdnFrontDoorFirewallManagedRuleGroupExclusion(override["exclusion"].([]interface{})) ruleGroupName := override["rule_group_name"].(string) - rules, err := expandCdnFrontDoorFirewallRuleOverride(override["rule"].([]interface{}), versionRaw, version) + rules, err := expandCdnFrontDoorFirewallRuleOverride(override["rule"].([]interface{}), versionRaw, version, ruleType) if err != nil { return nil, err } @@ -899,7 +897,7 @@ func expandCdnFrontDoorFirewallManagedRuleGroupOverride(input []interface{}, ver return &result, nil } -func expandCdnFrontDoorFirewallRuleOverride(input []interface{}, versionRaw string, version float64) (*[]waf.ManagedRuleOverride, error) { +func expandCdnFrontDoorFirewallRuleOverride(input []interface{}, versionRaw string, version float64, ruleType string) (*[]waf.ManagedRuleOverride, error) { result := make([]waf.ManagedRuleOverride, 0) if len(input) == 0 { return nil, nil @@ -919,9 +917,11 @@ func expandCdnFrontDoorFirewallRuleOverride(input []interface{}, versionRaw stri // NOTE: Default Rule Sets(DRS) 2.0 and above rules only use action type of 'AnomalyScoring' or 'Log'. Issues 19088 and 19561 // This will still work for bot rules as well since it will be the default value of 1.0 if version < 2.0 && action == waf.ActionTypeAnomalyScoring { - return nil, fmt.Errorf("'AnomalyScoring' is only valid in managed rules that are DRS 2.0 and above, got %q", versionRaw) + return nil, fmt.Errorf("%q is only valid in managed rules 'type' is DRS 2.0 and above, got %q", waf.ActionTypeAnomalyScoring, versionRaw) } else if version >= 2.0 && action != waf.ActionTypeAnomalyScoring && action != waf.ActionTypeLog { return nil, fmt.Errorf("the managed rules 'action' field must be set to 'AnomalyScoring' or 'Log' if the managed rule is DRS 2.0 or above, got %q", action) + } else if !strings.Contains(strings.ToLower(ruleType), "botmanagerruleset") && action == waf.ActionTypeJSChallenge { + return nil, fmt.Errorf("%q is only valid if the managed rules 'type' is 'Microsoft_BotManagerRuleSet', got %q", waf.ActionTypeJSChallenge, ruleType) } exclusions := expandCdnFrontDoorFirewallManagedRuleGroupExclusion(rule["exclusion"].([]interface{})) diff --git a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go index 3b51daec370c..ad63cbee0b92 100644 --- a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go @@ -9,12 +9,13 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "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" ) type CdnFrontDoorFirewallPolicyResource struct{} @@ -253,21 +254,75 @@ func TestAccCdnFrontDoorFirewallPolicy_DRSTwoPointOneActionError(t *testing.T) { }) } +// TODO: run these tests to make sure they work... +func TestAccCdnFrontDoorFirewallPolicy_JSChallengeDRSError(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_firewall_policy", "test") + r := CdnFrontDoorFirewallPolicyResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.JSChallengeDRSError(data), + ExpectError: regexp.MustCompile(`"JSChallenge" is only valid if the managed rules 'type' is 'Microsoft_BotManagerRuleSet', got "DefaultRuleSet"`), + }, + }) +} + +func TestAccCdnFrontDoorFirewallPolicy_JSChallengeBasic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_firewall_policy", "test") + r := CdnFrontDoorFirewallPolicyResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.JSChallengeBasic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccCdnFrontDoorFirewallPolicy_JSChallengeUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_firewall_policy", "test") + r := CdnFrontDoorFirewallPolicyResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.JSChallengeBasic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.JSChallengeRemove(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.JSChallengeBasic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (CdnFrontDoorFirewallPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.FrontDoorFirewallPolicyID(state.ID) + id, err := waf.ParseFrontDoorWebApplicationFirewallPolicyID(state.ID) if err != nil { return nil, err } - resp, err := clients.Cdn.FrontDoorLegacyFirewallPoliciesClient.Get(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + resp, err := clients.Cdn.FrontDoorFirewallPoliciesClient.PoliciesGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return utils.Bool(false), nil + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil } return nil, fmt.Errorf("retrieving %s: %+v", id, err) } - return utils.Bool(true), nil + return pointer.To(true), nil } func (CdnFrontDoorFirewallPolicyResource) template(data acceptance.TestData) string { @@ -793,3 +848,95 @@ resource "azurerm_cdn_frontdoor_firewall_policy" "test" { } `, tmp, data.RandomInteger) } + +func (r CdnFrontDoorFirewallPolicyResource) JSChallengeDRSError(data acceptance.TestData) string { + tmp := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_cdn_frontdoor_firewall_policy" "test" { + name = "accTestWAF%d" + resource_group_name = azurerm_resource_group.test.name + sku_name = azurerm_cdn_frontdoor_profile.test.sku_name + enabled = true + mode = "Prevention" + redirect_url = "https://www.contoso.com" + custom_block_response_status_code = 403 + custom_block_response_body = "PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg==" + + managed_rule { + type = "DefaultRuleSet" + version = "preview-0.1" + action = "Block" + + override { + rule_group_name = "PHP" + + rule { + rule_id = "933100" + enabled = false + action = "JSChallenge" + } + } + } +} +`, tmp, data.RandomInteger) +} + +func (r CdnFrontDoorFirewallPolicyResource) JSChallengeBasic(data acceptance.TestData) string { + tmp := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_cdn_frontdoor_firewall_policy" "test" { + name = "accTestWAF%d" + resource_group_name = azurerm_resource_group.test.name + sku_name = azurerm_cdn_frontdoor_profile.test.sku_name + enabled = true + mode = "Prevention" + redirect_url = "https://www.contoso.com" + custom_block_response_status_code = 403 + custom_block_response_body = "PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg==" + + managed_rule { + type = "Microsoft_BotManagerRuleSet" + version = "1.0" + action = "Log" + + override { + rule_group_name = "BadBots" + + rule { + rule_id = "Bot100200" + enabled = true + action = "JSChallenge" + } + } + } +} +`, tmp, data.RandomInteger) +} + +func (r CdnFrontDoorFirewallPolicyResource) JSChallengeRemove(data acceptance.TestData) string { + tmp := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_cdn_frontdoor_firewall_policy" "test" { + name = "accTestWAF%d" + resource_group_name = azurerm_resource_group.test.name + sku_name = azurerm_cdn_frontdoor_profile.test.sku_name + enabled = true + mode = "Prevention" + redirect_url = "https://www.contoso.com" + custom_block_response_status_code = 403 + custom_block_response_body = "PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg==" + + managed_rule { + type = "Microsoft_BotManagerRuleSet" + version = "1.0" + action = "Log" + } +} +`, tmp, data.RandomInteger) +} diff --git a/internal/services/cdn/client/client.go b/internal/services/cdn/client/client.go index 1a651e3263e8..52c36e1cae2e 100644 --- a/internal/services/cdn/client/client.go +++ b/internal/services/cdn/client/client.go @@ -8,7 +8,6 @@ import ( cdnSdk "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck cdnFrontDoorSdk "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck - "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" // nolint: staticcheck "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/profiles" "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets" @@ -18,21 +17,20 @@ import ( ) type Client struct { - FrontDoorEndpointsClient *cdnFrontDoorSdk.AFDEndpointsClient - FrontDoorOriginGroupsClient *cdnFrontDoorSdk.AFDOriginGroupsClient - FrontDoorOriginsClient *cdnFrontDoorSdk.AFDOriginsClient - FrontDoorCustomDomainsClient *cdnFrontDoorSdk.AFDCustomDomainsClient - FrontDoorSecurityPoliciesClient *securitypolicies.SecurityPoliciesClient - FrontDoorRoutesClient *cdnFrontDoorSdk.RoutesClient - FrontDoorRulesClient *rules.RulesClient - FrontDoorProfilesClient *profiles.ProfilesClient - FrontDoorSecretsClient *cdnFrontDoorSdk.SecretsClient - FrontDoorRuleSetsClient *rulesets.RuleSetsClient - FrontDoorLegacyFirewallPoliciesClient *frontdoor.PoliciesClient - FrontDoorFirewallPoliciesClient *waf.WebApplicationFirewallPoliciesClient - CustomDomainsClient *cdnSdk.CustomDomainsClient - EndpointsClient *cdnSdk.EndpointsClient - ProfilesClient *cdnSdk.ProfilesClient + FrontDoorEndpointsClient *cdnFrontDoorSdk.AFDEndpointsClient + FrontDoorOriginGroupsClient *cdnFrontDoorSdk.AFDOriginGroupsClient + FrontDoorOriginsClient *cdnFrontDoorSdk.AFDOriginsClient + FrontDoorCustomDomainsClient *cdnFrontDoorSdk.AFDCustomDomainsClient + FrontDoorSecurityPoliciesClient *securitypolicies.SecurityPoliciesClient + FrontDoorRoutesClient *cdnFrontDoorSdk.RoutesClient + FrontDoorRulesClient *rules.RulesClient + FrontDoorProfilesClient *profiles.ProfilesClient + FrontDoorSecretsClient *cdnFrontDoorSdk.SecretsClient + FrontDoorRuleSetsClient *rulesets.RuleSetsClient + FrontDoorFirewallPoliciesClient *waf.WebApplicationFirewallPoliciesClient + CustomDomainsClient *cdnSdk.CustomDomainsClient + EndpointsClient *cdnSdk.EndpointsClient + ProfilesClient *cdnSdk.ProfilesClient } func NewClient(o *common.ClientOptions) (*Client, error) { @@ -54,9 +52,6 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(frontDoorSecurityPoliciesClient.Client, o.Authorizers.ResourceManager) - frontDoorLegacyFirewallPoliciesClient := frontdoor.NewPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&frontDoorLegacyFirewallPoliciesClient.Client, o.ResourceManagerAuthorizer) - frontDoorFirewallPoliciesClient := waf.NewWebApplicationFirewallPoliciesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&frontDoorFirewallPoliciesClient.Client, o.ResourceManagerAuthorizer) @@ -94,21 +89,20 @@ func NewClient(o *common.ClientOptions) (*Client, error) { o.ConfigureClient(&profilesClient.Client, o.ResourceManagerAuthorizer) client := Client{ - FrontDoorEndpointsClient: &frontDoorEndpointsClient, - FrontDoorOriginGroupsClient: &frontDoorOriginGroupsClient, - FrontDoorOriginsClient: &frontDoorOriginsClient, - FrontDoorCustomDomainsClient: &frontDoorCustomDomainsClient, - FrontDoorSecurityPoliciesClient: frontDoorSecurityPoliciesClient, - FrontDoorRoutesClient: &frontDoorRoutesClient, - FrontDoorRulesClient: frontDoorRulesClient, - FrontDoorProfilesClient: frontDoorProfilesClient, - FrontDoorSecretsClient: &frontDoorPolicySecretsClient, - FrontDoorRuleSetsClient: frontDoorRuleSetsClient, - FrontDoorLegacyFirewallPoliciesClient: &frontDoorLegacyFirewallPoliciesClient, - FrontDoorFirewallPoliciesClient: &frontDoorFirewallPoliciesClient, - CustomDomainsClient: &customDomainsClient, - EndpointsClient: &endpointsClient, - ProfilesClient: &profilesClient, + FrontDoorEndpointsClient: &frontDoorEndpointsClient, + FrontDoorOriginGroupsClient: &frontDoorOriginGroupsClient, + FrontDoorOriginsClient: &frontDoorOriginsClient, + FrontDoorCustomDomainsClient: &frontDoorCustomDomainsClient, + FrontDoorSecurityPoliciesClient: frontDoorSecurityPoliciesClient, + FrontDoorRoutesClient: &frontDoorRoutesClient, + FrontDoorRulesClient: frontDoorRulesClient, + FrontDoorProfilesClient: frontDoorProfilesClient, + FrontDoorSecretsClient: &frontDoorPolicySecretsClient, + FrontDoorRuleSetsClient: frontDoorRuleSetsClient, + FrontDoorFirewallPoliciesClient: &frontDoorFirewallPoliciesClient, + CustomDomainsClient: &customDomainsClient, + EndpointsClient: &endpointsClient, + ProfilesClient: &profilesClient, } return &client, nil diff --git a/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown b/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown index 92a0c6568afe..a518894f5661 100644 --- a/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown +++ b/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown @@ -137,7 +137,7 @@ The following arguments are supported: * `sku_name` - (Required) The sku's pricing tier for this Front Door Firewall Policy. Possible values include `Standard_AzureFrontDoor` or `Premium_AzureFrontDoor`. Changing this forces a new resource to be created. --> **NOTE:** The `Standard_AzureFrontDoor` Front Door Firewall Policy sku may contain `custom` rules only. The `Premium_AzureFrontDoor` Front Door Firewall Policy skus may contain both `custom` and `managed` rules. +-> **Note:** The `Standard_AzureFrontDoor` Front Door Firewall Policy sku may contain `custom` rules only. The `Premium_AzureFrontDoor` Front Door Firewall Policy skus may contain both `custom` and `managed` rules. * `enabled` - (Optional) Is the Front Door Firewall Policy enabled? Defaults to `true`. @@ -145,7 +145,7 @@ The following arguments are supported: * `request_body_check_enabled` - (Optional) Should policy managed rules inspect the request body content? Defaults to `true`. --> **NOTE:** When run in `Detection` mode, the Front Door Firewall Policy doesn't take any other actions other than monitoring and logging the request and its matched Front Door Rule to the Web Application Firewall logs. +-> **Note:** When run in `Detection` mode, the Front Door Firewall Policy doesn't take any other actions other than monitoring and logging the request and its matched Front Door Rule to the Web Application Firewall logs. * `redirect_url` - (Optional) If action type is redirect, this field represents redirect URL for the client. @@ -201,9 +201,9 @@ A `managed_rule` block supports the following: * `type` - (Required) The name of the managed rule to use with this resource. Possible values include `DefaultRuleSet`, `Microsoft_DefaultRuleSet`, `BotProtection` or `Microsoft_BotManagerRuleSet`. -* `version` - (Required) The version of the managed rule to use with this resource. Possible values depends on which DRS type you are using, for the `DefaultRuleSet` type the possible values include `1.0` or `preview-0.1`. For `Microsoft_DefaultRuleSet` the possible values include `1.1`, `2.0` or `2.1`. For `BotProtection` the value must be `preview-0.1` and for `Microsoft_BotManagerRuleSet` the possible values include `1.0` and `1.1`. +* `version` - (Required) The version of the managed rule to use with this resource. Possible values depends on which rule set type you are using, for the `DefaultRuleSet` type the possible values include `1.0` or `preview-0.1`. For `Microsoft_DefaultRuleSet` the possible values include `1.1`, `2.0` or `2.1`. For `BotProtection` the value must be `preview-0.1` and for `Microsoft_BotManagerRuleSet` the possible values include `1.0` and `1.1`. -* `action` - (Required) The action to perform for all DRS rules when the managed rule is matched or when the anomaly score is 5 or greater depending on which version of the DRS you are using. Possible values include `Allow`, `Log`, `Block`, and `Redirect`. +* `action` - (Required) The action to perform for all rule set rules when the managed rule is matched or when the anomaly score is 5 or greater depending on which version of the rule set you are using. Possible values include `Allow`, `Log`, `Block`, and `Redirect`. * `exclusion` - (Optional) One or more `exclusion` blocks as defined below. @@ -225,9 +225,9 @@ A `rule` block supports the following: * `rule_id` - (Required) Identifier for the managed rule. -* `action` - (Required) The action to be applied when the managed rule matches or when the anomaly score is 5 or greater. Possible values for DRS `1.1` and below are `Allow`, `Log`, `Block`, and `Redirect`. For DRS `2.0` and above the possible values are `Log` or `AnomalyScoring`. +* `action` - (Required) The action to be applied when the managed rule matches or when the anomaly score is 5 or greater. Possible values for `DefaultRuleSet 1.1` and below are `Allow`, `Log`, `Block`, or `Redirect`. Possible values for `DefaultRuleSet 2.0` and above are `Log` or `AnomalyScoring`. Possible values for `Microsoft_BotManagerRuleSet` are `Allow`, `Log`, `Block`, `Redirect` or `JSChallenge`. -->**NOTE:** Please see the DRS [product documentation](https://learn.microsoft.com/azure/web-application-firewall/afds/waf-front-door-drs?tabs=drs20#anomaly-scoring-mode) for more information. +->**Note:** Please see the `DefaultRuleSet` [product documentation](https://learn.microsoft.com/azure/web-application-firewall/afds/waf-front-door-drs?tabs=drs20#anomaly-scoring-mode) or the `Microsoft_BotManagerRuleSet` [product documentation](https://learn.microsoft.com/azure/web-application-firewall/afds/afds-overview) for more information. * `enabled` - (Optional) Is the managed rule override enabled or disabled. Defaults to `false` @@ -239,13 +239,13 @@ An `exclusion` block supports the following: * `match_variable` - (Required) The variable type to be excluded. Possible values are `QueryStringArgNames`, `RequestBodyPostArgNames`, `RequestCookieNames`, `RequestHeaderNames`, `RequestBodyJsonArgNames` --> **NOTE:** `RequestBodyJsonArgNames` is only available on Default Rule Set (DRS) 2.0 or later +-> **Note:** `RequestBodyJsonArgNames` is only available on Default Rule Set (DRS) 2.0 or later * `operator` - (Required) Comparison operator to apply to the selector when specifying which elements in the collection this exclusion applies to. Possible values are: `Equals`, `Contains`, `StartsWith`, `EndsWith`, `EqualsAny`. * `selector` - (Required) Selector for the value in the `match_variable` attribute this exclusion applies to. --> **NOTE:** `selector` must be set to `*` if `operator` is set to `EqualsAny`. +-> **Note:** `selector` must be set to `*` if `operator` is set to `EqualsAny`. ## Attributes Reference From 225d716fcbf979b5e69992a3e25d22da66e85121 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Fri, 31 Jan 2025 01:22:11 -0700 Subject: [PATCH 09/17] go mod vendor to remove legacy API dependency... --- .../mgmt/2020-11-01/frontdoor/CHANGELOG.md | 2 - .../mgmt/2020-11-01/frontdoor/_meta.json | 11 - .../mgmt/2020-11-01/frontdoor/client.go | 43 - .../mgmt/2020-11-01/frontdoor/endpoints.go | 129 - .../mgmt/2020-11-01/frontdoor/enums.go | 960 ---- .../mgmt/2020-11-01/frontdoor/experiments.go | 534 -- .../mgmt/2020-11-01/frontdoor/frontdoors.go | 635 --- .../2020-11-01/frontdoor/frontendendpoints.go | 454 -- .../2020-11-01/frontdoor/managedrulesets.go | 144 - .../mgmt/2020-11-01/frontdoor/models.go | 4945 ----------------- .../2020-11-01/frontdoor/nameavailability.go | 110 - .../nameavailabilitywithsubscription.go | 114 - .../frontdoor/networkexperimentprofiles.go | 628 --- .../mgmt/2020-11-01/frontdoor/policies.go | 429 -- .../frontdoor/preconfiguredendpoints.go | 161 - .../mgmt/2020-11-01/frontdoor/reports.go | 241 - .../mgmt/2020-11-01/frontdoor/rulesengines.go | 456 -- .../mgmt/2020-11-01/frontdoor/version.go | 19 - vendor/modules.txt | 1 - 19 files changed, 10016 deletions(-) delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/CHANGELOG.md delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/_meta.json delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/client.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/endpoints.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/enums.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/experiments.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontdoors.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontendendpoints.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/managedrulesets.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/models.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailability.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailabilitywithsubscription.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/networkexperimentprofiles.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/policies.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/preconfiguredendpoints.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/reports.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/rulesengines.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/version.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/_meta.json deleted file mode 100644 index ee8af71f0437..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3e1f462ff6a7daa705ac58f1772dd5c429bb8d2e", - "readme": "/_/azure-rest-api-specs/specification/frontdoor/resource-manager/readme.md", - "tag": "package-2020-11", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-11 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/frontdoor/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/client.go deleted file mode 100644 index 519f58cca2bf..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package frontdoor implements the Azure ARM Frontdoor service API version . -// -// FrontDoor Client -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Frontdoor - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Frontdoor. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/endpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/endpoints.go deleted file mode 100644 index 2f8be50aaca6..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/endpoints.go +++ /dev/null @@ -1,129 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// EndpointsClient is the frontDoor Client -type EndpointsClient struct { - BaseClient -} - -// NewEndpointsClient creates an instance of the EndpointsClient client. -func NewEndpointsClient(subscriptionID string) EndpointsClient { - return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { - return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// PurgeContent removes a content from Front Door. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -// contentFilePaths - the path to the content to be purged. Path can be a full URL, e.g. '/pictures/city.png' -// which removes a single file, or a directory with a wildcard, e.g. '/pictures/*' which removes all folders -// and files in the directory. -func (client EndpointsClient) PurgeContent(ctx context.Context, resourceGroupName string, frontDoorName string, contentFilePaths PurgeParameters) (result EndpointsPurgeContentFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.PurgeContent") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, - {TargetValue: contentFilePaths, - Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.EndpointsClient", "PurgeContent", err.Error()) - } - - req, err := client.PurgeContentPreparer(ctx, resourceGroupName, frontDoorName, contentFilePaths) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.EndpointsClient", "PurgeContent", nil, "Failure preparing request") - return - } - - result, err = client.PurgeContentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.EndpointsClient", "PurgeContent", result.Response(), "Failure sending request") - return - } - - return -} - -// PurgeContentPreparer prepares the PurgeContent request. -func (client EndpointsClient) PurgeContentPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, contentFilePaths PurgeParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/purge", pathParameters), - autorest.WithJSON(contentFilePaths), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PurgeContentSender sends the PurgeContent request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) PurgeContentSender(req *http.Request) (future EndpointsPurgeContentFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PurgeContentResponder handles the response to the PurgeContent request. The method always -// closes the http.Response Body. -func (client EndpointsClient) PurgeContentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/enums.go deleted file mode 100644 index 61ed833e4002..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/enums.go +++ /dev/null @@ -1,960 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActionType enumerates the values for action type. -type ActionType string - -const ( - // ActionTypeAllow ... - ActionTypeAllow ActionType = "Allow" - // ActionTypeBlock ... - ActionTypeBlock ActionType = "Block" - // ActionTypeLog ... - ActionTypeLog ActionType = "Log" - // ActionTypeRedirect ... - ActionTypeRedirect ActionType = "Redirect" -) - -// PossibleActionTypeValues returns an array of possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ActionTypeAllow, ActionTypeBlock, ActionTypeLog, ActionTypeRedirect} -} - -// AggregationInterval enumerates the values for aggregation interval. -type AggregationInterval string - -const ( - // AggregationIntervalDaily ... - AggregationIntervalDaily AggregationInterval = "Daily" - // AggregationIntervalHourly ... - AggregationIntervalHourly AggregationInterval = "Hourly" -) - -// PossibleAggregationIntervalValues returns an array of possible values for the AggregationInterval const type. -func PossibleAggregationIntervalValues() []AggregationInterval { - return []AggregationInterval{AggregationIntervalDaily, AggregationIntervalHourly} -} - -// Availability enumerates the values for availability. -type Availability string - -const ( - // AvailabilityAvailable ... - AvailabilityAvailable Availability = "Available" - // AvailabilityUnavailable ... - AvailabilityUnavailable Availability = "Unavailable" -) - -// PossibleAvailabilityValues returns an array of possible values for the Availability const type. -func PossibleAvailabilityValues() []Availability { - return []Availability{AvailabilityAvailable, AvailabilityUnavailable} -} - -// BackendEnabledState enumerates the values for backend enabled state. -type BackendEnabledState string - -const ( - // BackendEnabledStateDisabled ... - BackendEnabledStateDisabled BackendEnabledState = "Disabled" - // BackendEnabledStateEnabled ... - BackendEnabledStateEnabled BackendEnabledState = "Enabled" -) - -// PossibleBackendEnabledStateValues returns an array of possible values for the BackendEnabledState const type. -func PossibleBackendEnabledStateValues() []BackendEnabledState { - return []BackendEnabledState{BackendEnabledStateDisabled, BackendEnabledStateEnabled} -} - -// CertificateSource enumerates the values for certificate source. -type CertificateSource string - -const ( - // CertificateSourceAzureKeyVault ... - CertificateSourceAzureKeyVault CertificateSource = "AzureKeyVault" - // CertificateSourceFrontDoor ... - CertificateSourceFrontDoor CertificateSource = "FrontDoor" -) - -// PossibleCertificateSourceValues returns an array of possible values for the CertificateSource const type. -func PossibleCertificateSourceValues() []CertificateSource { - return []CertificateSource{CertificateSourceAzureKeyVault, CertificateSourceFrontDoor} -} - -// CertificateType enumerates the values for certificate type. -type CertificateType string - -const ( - // CertificateTypeDedicated ... - CertificateTypeDedicated CertificateType = "Dedicated" -) - -// PossibleCertificateTypeValues returns an array of possible values for the CertificateType const type. -func PossibleCertificateTypeValues() []CertificateType { - return []CertificateType{CertificateTypeDedicated} -} - -// CustomHTTPSProvisioningState enumerates the values for custom https provisioning state. -type CustomHTTPSProvisioningState string - -const ( - // CustomHTTPSProvisioningStateDisabled ... - CustomHTTPSProvisioningStateDisabled CustomHTTPSProvisioningState = "Disabled" - // CustomHTTPSProvisioningStateDisabling ... - CustomHTTPSProvisioningStateDisabling CustomHTTPSProvisioningState = "Disabling" - // CustomHTTPSProvisioningStateEnabled ... - CustomHTTPSProvisioningStateEnabled CustomHTTPSProvisioningState = "Enabled" - // CustomHTTPSProvisioningStateEnabling ... - CustomHTTPSProvisioningStateEnabling CustomHTTPSProvisioningState = "Enabling" - // CustomHTTPSProvisioningStateFailed ... - CustomHTTPSProvisioningStateFailed CustomHTTPSProvisioningState = "Failed" -) - -// PossibleCustomHTTPSProvisioningStateValues returns an array of possible values for the CustomHTTPSProvisioningState const type. -func PossibleCustomHTTPSProvisioningStateValues() []CustomHTTPSProvisioningState { - return []CustomHTTPSProvisioningState{CustomHTTPSProvisioningStateDisabled, CustomHTTPSProvisioningStateDisabling, CustomHTTPSProvisioningStateEnabled, CustomHTTPSProvisioningStateEnabling, CustomHTTPSProvisioningStateFailed} -} - -// CustomHTTPSProvisioningSubstate enumerates the values for custom https provisioning substate. -type CustomHTTPSProvisioningSubstate string - -const ( - // CustomHTTPSProvisioningSubstateCertificateDeleted ... - CustomHTTPSProvisioningSubstateCertificateDeleted CustomHTTPSProvisioningSubstate = "CertificateDeleted" - // CustomHTTPSProvisioningSubstateCertificateDeployed ... - CustomHTTPSProvisioningSubstateCertificateDeployed CustomHTTPSProvisioningSubstate = "CertificateDeployed" - // CustomHTTPSProvisioningSubstateDeletingCertificate ... - CustomHTTPSProvisioningSubstateDeletingCertificate CustomHTTPSProvisioningSubstate = "DeletingCertificate" - // CustomHTTPSProvisioningSubstateDeployingCertificate ... - CustomHTTPSProvisioningSubstateDeployingCertificate CustomHTTPSProvisioningSubstate = "DeployingCertificate" - // CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved ... - CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestApproved" - // CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected ... - CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestRejected" - // CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut ... - CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestTimedOut" - // CustomHTTPSProvisioningSubstateIssuingCertificate ... - CustomHTTPSProvisioningSubstateIssuingCertificate CustomHTTPSProvisioningSubstate = "IssuingCertificate" - // CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval ... - CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval CustomHTTPSProvisioningSubstate = "PendingDomainControlValidationREquestApproval" - // CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest ... - CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest CustomHTTPSProvisioningSubstate = "SubmittingDomainControlValidationRequest" -) - -// PossibleCustomHTTPSProvisioningSubstateValues returns an array of possible values for the CustomHTTPSProvisioningSubstate const type. -func PossibleCustomHTTPSProvisioningSubstateValues() []CustomHTTPSProvisioningSubstate { - return []CustomHTTPSProvisioningSubstate{CustomHTTPSProvisioningSubstateCertificateDeleted, CustomHTTPSProvisioningSubstateCertificateDeployed, CustomHTTPSProvisioningSubstateDeletingCertificate, CustomHTTPSProvisioningSubstateDeployingCertificate, CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved, CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected, CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut, CustomHTTPSProvisioningSubstateIssuingCertificate, CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval, CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest} -} - -// CustomRuleEnabledState enumerates the values for custom rule enabled state. -type CustomRuleEnabledState string - -const ( - // CustomRuleEnabledStateDisabled ... - CustomRuleEnabledStateDisabled CustomRuleEnabledState = "Disabled" - // CustomRuleEnabledStateEnabled ... - CustomRuleEnabledStateEnabled CustomRuleEnabledState = "Enabled" -) - -// PossibleCustomRuleEnabledStateValues returns an array of possible values for the CustomRuleEnabledState const type. -func PossibleCustomRuleEnabledStateValues() []CustomRuleEnabledState { - return []CustomRuleEnabledState{CustomRuleEnabledStateDisabled, CustomRuleEnabledStateEnabled} -} - -// DynamicCompressionEnabled enumerates the values for dynamic compression enabled. -type DynamicCompressionEnabled string - -const ( - // DynamicCompressionEnabledDisabled ... - DynamicCompressionEnabledDisabled DynamicCompressionEnabled = "Disabled" - // DynamicCompressionEnabledEnabled ... - DynamicCompressionEnabledEnabled DynamicCompressionEnabled = "Enabled" -) - -// PossibleDynamicCompressionEnabledValues returns an array of possible values for the DynamicCompressionEnabled const type. -func PossibleDynamicCompressionEnabledValues() []DynamicCompressionEnabled { - return []DynamicCompressionEnabled{DynamicCompressionEnabledDisabled, DynamicCompressionEnabledEnabled} -} - -// EnabledState enumerates the values for enabled state. -type EnabledState string - -const ( - // EnabledStateDisabled ... - EnabledStateDisabled EnabledState = "Disabled" - // EnabledStateEnabled ... - EnabledStateEnabled EnabledState = "Enabled" -) - -// PossibleEnabledStateValues returns an array of possible values for the EnabledState const type. -func PossibleEnabledStateValues() []EnabledState { - return []EnabledState{EnabledStateDisabled, EnabledStateEnabled} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeAFD ... - EndpointTypeAFD EndpointType = "AFD" - // EndpointTypeATM ... - EndpointTypeATM EndpointType = "ATM" - // EndpointTypeAzureRegion ... - EndpointTypeAzureRegion EndpointType = "AzureRegion" - // EndpointTypeCDN ... - EndpointTypeCDN EndpointType = "CDN" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeAFD, EndpointTypeATM, EndpointTypeAzureRegion, EndpointTypeCDN} -} - -// EnforceCertificateNameCheckEnabledState enumerates the values for enforce certificate name check enabled -// state. -type EnforceCertificateNameCheckEnabledState string - -const ( - // EnforceCertificateNameCheckEnabledStateDisabled ... - EnforceCertificateNameCheckEnabledStateDisabled EnforceCertificateNameCheckEnabledState = "Disabled" - // EnforceCertificateNameCheckEnabledStateEnabled ... - EnforceCertificateNameCheckEnabledStateEnabled EnforceCertificateNameCheckEnabledState = "Enabled" -) - -// PossibleEnforceCertificateNameCheckEnabledStateValues returns an array of possible values for the EnforceCertificateNameCheckEnabledState const type. -func PossibleEnforceCertificateNameCheckEnabledStateValues() []EnforceCertificateNameCheckEnabledState { - return []EnforceCertificateNameCheckEnabledState{EnforceCertificateNameCheckEnabledStateDisabled, EnforceCertificateNameCheckEnabledStateEnabled} -} - -// ForwardingProtocol enumerates the values for forwarding protocol. -type ForwardingProtocol string - -const ( - // ForwardingProtocolHTTPOnly ... - ForwardingProtocolHTTPOnly ForwardingProtocol = "HttpOnly" - // ForwardingProtocolHTTPSOnly ... - ForwardingProtocolHTTPSOnly ForwardingProtocol = "HttpsOnly" - // ForwardingProtocolMatchRequest ... - ForwardingProtocolMatchRequest ForwardingProtocol = "MatchRequest" -) - -// PossibleForwardingProtocolValues returns an array of possible values for the ForwardingProtocol const type. -func PossibleForwardingProtocolValues() []ForwardingProtocol { - return []ForwardingProtocol{ForwardingProtocolHTTPOnly, ForwardingProtocolHTTPSOnly, ForwardingProtocolMatchRequest} -} - -// HeaderActionType enumerates the values for header action type. -type HeaderActionType string - -const ( - // HeaderActionTypeAppend ... - HeaderActionTypeAppend HeaderActionType = "Append" - // HeaderActionTypeDelete ... - HeaderActionTypeDelete HeaderActionType = "Delete" - // HeaderActionTypeOverwrite ... - HeaderActionTypeOverwrite HeaderActionType = "Overwrite" -) - -// PossibleHeaderActionTypeValues returns an array of possible values for the HeaderActionType const type. -func PossibleHeaderActionTypeValues() []HeaderActionType { - return []HeaderActionType{HeaderActionTypeAppend, HeaderActionTypeDelete, HeaderActionTypeOverwrite} -} - -// HealthProbeEnabled enumerates the values for health probe enabled. -type HealthProbeEnabled string - -const ( - // HealthProbeEnabledDisabled ... - HealthProbeEnabledDisabled HealthProbeEnabled = "Disabled" - // HealthProbeEnabledEnabled ... - HealthProbeEnabledEnabled HealthProbeEnabled = "Enabled" -) - -// PossibleHealthProbeEnabledValues returns an array of possible values for the HealthProbeEnabled const type. -func PossibleHealthProbeEnabledValues() []HealthProbeEnabled { - return []HealthProbeEnabled{HealthProbeEnabledDisabled, HealthProbeEnabledEnabled} -} - -// HealthProbeMethod enumerates the values for health probe method. -type HealthProbeMethod string - -const ( - // HealthProbeMethodGET ... - HealthProbeMethodGET HealthProbeMethod = "GET" - // HealthProbeMethodHEAD ... - HealthProbeMethodHEAD HealthProbeMethod = "HEAD" -) - -// PossibleHealthProbeMethodValues returns an array of possible values for the HealthProbeMethod const type. -func PossibleHealthProbeMethodValues() []HealthProbeMethod { - return []HealthProbeMethod{HealthProbeMethodGET, HealthProbeMethodHEAD} -} - -// LatencyScorecardAggregationInterval enumerates the values for latency scorecard aggregation interval. -type LatencyScorecardAggregationInterval string - -const ( - // LatencyScorecardAggregationIntervalDaily ... - LatencyScorecardAggregationIntervalDaily LatencyScorecardAggregationInterval = "Daily" - // LatencyScorecardAggregationIntervalMonthly ... - LatencyScorecardAggregationIntervalMonthly LatencyScorecardAggregationInterval = "Monthly" - // LatencyScorecardAggregationIntervalWeekly ... - LatencyScorecardAggregationIntervalWeekly LatencyScorecardAggregationInterval = "Weekly" -) - -// PossibleLatencyScorecardAggregationIntervalValues returns an array of possible values for the LatencyScorecardAggregationInterval const type. -func PossibleLatencyScorecardAggregationIntervalValues() []LatencyScorecardAggregationInterval { - return []LatencyScorecardAggregationInterval{LatencyScorecardAggregationIntervalDaily, LatencyScorecardAggregationIntervalMonthly, LatencyScorecardAggregationIntervalWeekly} -} - -// ManagedRuleEnabledState enumerates the values for managed rule enabled state. -type ManagedRuleEnabledState string - -const ( - // ManagedRuleEnabledStateDisabled ... - ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" - // ManagedRuleEnabledStateEnabled ... - ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" -) - -// PossibleManagedRuleEnabledStateValues returns an array of possible values for the ManagedRuleEnabledState const type. -func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { - return []ManagedRuleEnabledState{ManagedRuleEnabledStateDisabled, ManagedRuleEnabledStateEnabled} -} - -// ManagedRuleExclusionMatchVariable enumerates the values for managed rule exclusion match variable. -type ManagedRuleExclusionMatchVariable string - -const ( - // ManagedRuleExclusionMatchVariableQueryStringArgNames ... - ManagedRuleExclusionMatchVariableQueryStringArgNames ManagedRuleExclusionMatchVariable = "QueryStringArgNames" - // ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames ... - ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames ManagedRuleExclusionMatchVariable = "RequestBodyJsonArgNames" - // ManagedRuleExclusionMatchVariableRequestBodyPostArgNames ... - ManagedRuleExclusionMatchVariableRequestBodyPostArgNames ManagedRuleExclusionMatchVariable = "RequestBodyPostArgNames" - // ManagedRuleExclusionMatchVariableRequestCookieNames ... - ManagedRuleExclusionMatchVariableRequestCookieNames ManagedRuleExclusionMatchVariable = "RequestCookieNames" - // ManagedRuleExclusionMatchVariableRequestHeaderNames ... - ManagedRuleExclusionMatchVariableRequestHeaderNames ManagedRuleExclusionMatchVariable = "RequestHeaderNames" -) - -// PossibleManagedRuleExclusionMatchVariableValues returns an array of possible values for the ManagedRuleExclusionMatchVariable const type. -func PossibleManagedRuleExclusionMatchVariableValues() []ManagedRuleExclusionMatchVariable { - return []ManagedRuleExclusionMatchVariable{ManagedRuleExclusionMatchVariableQueryStringArgNames, ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames, ManagedRuleExclusionMatchVariableRequestBodyPostArgNames, ManagedRuleExclusionMatchVariableRequestCookieNames, ManagedRuleExclusionMatchVariableRequestHeaderNames} -} - -// ManagedRuleExclusionSelectorMatchOperator enumerates the values for managed rule exclusion selector match -// operator. -type ManagedRuleExclusionSelectorMatchOperator string - -const ( - // ManagedRuleExclusionSelectorMatchOperatorContains ... - ManagedRuleExclusionSelectorMatchOperatorContains ManagedRuleExclusionSelectorMatchOperator = "Contains" - // ManagedRuleExclusionSelectorMatchOperatorEndsWith ... - ManagedRuleExclusionSelectorMatchOperatorEndsWith ManagedRuleExclusionSelectorMatchOperator = "EndsWith" - // ManagedRuleExclusionSelectorMatchOperatorEquals ... - ManagedRuleExclusionSelectorMatchOperatorEquals ManagedRuleExclusionSelectorMatchOperator = "Equals" - // ManagedRuleExclusionSelectorMatchOperatorEqualsAny ... - ManagedRuleExclusionSelectorMatchOperatorEqualsAny ManagedRuleExclusionSelectorMatchOperator = "EqualsAny" - // ManagedRuleExclusionSelectorMatchOperatorStartsWith ... - ManagedRuleExclusionSelectorMatchOperatorStartsWith ManagedRuleExclusionSelectorMatchOperator = "StartsWith" -) - -// PossibleManagedRuleExclusionSelectorMatchOperatorValues returns an array of possible values for the ManagedRuleExclusionSelectorMatchOperator const type. -func PossibleManagedRuleExclusionSelectorMatchOperatorValues() []ManagedRuleExclusionSelectorMatchOperator { - return []ManagedRuleExclusionSelectorMatchOperator{ManagedRuleExclusionSelectorMatchOperatorContains, ManagedRuleExclusionSelectorMatchOperatorEndsWith, ManagedRuleExclusionSelectorMatchOperatorEquals, ManagedRuleExclusionSelectorMatchOperatorEqualsAny, ManagedRuleExclusionSelectorMatchOperatorStartsWith} -} - -// ManagedRuleSetActionType enumerates the values for managed rule set action type. -type ManagedRuleSetActionType string - -const ( - // ManagedRuleSetActionTypeBlock ... - ManagedRuleSetActionTypeBlock ManagedRuleSetActionType = "Block" - // ManagedRuleSetActionTypeLog ... - ManagedRuleSetActionTypeLog ManagedRuleSetActionType = "Log" - // ManagedRuleSetActionTypeRedirect ... - ManagedRuleSetActionTypeRedirect ManagedRuleSetActionType = "Redirect" -) - -// PossibleManagedRuleSetActionTypeValues returns an array of possible values for the ManagedRuleSetActionType const type. -func PossibleManagedRuleSetActionTypeValues() []ManagedRuleSetActionType { - return []ManagedRuleSetActionType{ManagedRuleSetActionTypeBlock, ManagedRuleSetActionTypeLog, ManagedRuleSetActionTypeRedirect} -} - -// MatchProcessingBehavior enumerates the values for match processing behavior. -type MatchProcessingBehavior string - -const ( - // MatchProcessingBehaviorContinue ... - MatchProcessingBehaviorContinue MatchProcessingBehavior = "Continue" - // MatchProcessingBehaviorStop ... - MatchProcessingBehaviorStop MatchProcessingBehavior = "Stop" -) - -// PossibleMatchProcessingBehaviorValues returns an array of possible values for the MatchProcessingBehavior const type. -func PossibleMatchProcessingBehaviorValues() []MatchProcessingBehavior { - return []MatchProcessingBehavior{MatchProcessingBehaviorContinue, MatchProcessingBehaviorStop} -} - -// MatchVariable enumerates the values for match variable. -type MatchVariable string - -const ( - // MatchVariableCookies ... - MatchVariableCookies MatchVariable = "Cookies" - // MatchVariablePostArgs ... - MatchVariablePostArgs MatchVariable = "PostArgs" - // MatchVariableQueryString ... - MatchVariableQueryString MatchVariable = "QueryString" - // MatchVariableRemoteAddr ... - MatchVariableRemoteAddr MatchVariable = "RemoteAddr" - // MatchVariableRequestBody ... - MatchVariableRequestBody MatchVariable = "RequestBody" - // MatchVariableRequestHeader ... - MatchVariableRequestHeader MatchVariable = "RequestHeader" - // MatchVariableRequestMethod ... - MatchVariableRequestMethod MatchVariable = "RequestMethod" - // MatchVariableRequestURI ... - MatchVariableRequestURI MatchVariable = "RequestUri" - // MatchVariableSocketAddr ... - MatchVariableSocketAddr MatchVariable = "SocketAddr" -) - -// PossibleMatchVariableValues returns an array of possible values for the MatchVariable const type. -func PossibleMatchVariableValues() []MatchVariable { - return []MatchVariable{MatchVariableCookies, MatchVariablePostArgs, MatchVariableQueryString, MatchVariableRemoteAddr, MatchVariableRequestBody, MatchVariableRequestHeader, MatchVariableRequestMethod, MatchVariableRequestURI, MatchVariableSocketAddr} -} - -// MinimumTLSVersion enumerates the values for minimum tls version. -type MinimumTLSVersion string - -const ( - // MinimumTLSVersionOneFullStopTwo ... - MinimumTLSVersionOneFullStopTwo MinimumTLSVersion = "1.2" - // MinimumTLSVersionOneFullStopZero ... - MinimumTLSVersionOneFullStopZero MinimumTLSVersion = "1.0" -) - -// PossibleMinimumTLSVersionValues returns an array of possible values for the MinimumTLSVersion const type. -func PossibleMinimumTLSVersionValues() []MinimumTLSVersion { - return []MinimumTLSVersion{MinimumTLSVersionOneFullStopTwo, MinimumTLSVersionOneFullStopZero} -} - -// NetworkExperimentResourceState enumerates the values for network experiment resource state. -type NetworkExperimentResourceState string - -const ( - // NetworkExperimentResourceStateCreating ... - NetworkExperimentResourceStateCreating NetworkExperimentResourceState = "Creating" - // NetworkExperimentResourceStateDeleting ... - NetworkExperimentResourceStateDeleting NetworkExperimentResourceState = "Deleting" - // NetworkExperimentResourceStateDisabled ... - NetworkExperimentResourceStateDisabled NetworkExperimentResourceState = "Disabled" - // NetworkExperimentResourceStateDisabling ... - NetworkExperimentResourceStateDisabling NetworkExperimentResourceState = "Disabling" - // NetworkExperimentResourceStateEnabled ... - NetworkExperimentResourceStateEnabled NetworkExperimentResourceState = "Enabled" - // NetworkExperimentResourceStateEnabling ... - NetworkExperimentResourceStateEnabling NetworkExperimentResourceState = "Enabling" -) - -// PossibleNetworkExperimentResourceStateValues returns an array of possible values for the NetworkExperimentResourceState const type. -func PossibleNetworkExperimentResourceStateValues() []NetworkExperimentResourceState { - return []NetworkExperimentResourceState{NetworkExperimentResourceStateCreating, NetworkExperimentResourceStateDeleting, NetworkExperimentResourceStateDisabled, NetworkExperimentResourceStateDisabling, NetworkExperimentResourceStateEnabled, NetworkExperimentResourceStateEnabling} -} - -// NetworkOperationStatus enumerates the values for network operation status. -type NetworkOperationStatus string - -const ( - // NetworkOperationStatusFailed ... - NetworkOperationStatusFailed NetworkOperationStatus = "Failed" - // NetworkOperationStatusInProgress ... - NetworkOperationStatusInProgress NetworkOperationStatus = "InProgress" - // NetworkOperationStatusSucceeded ... - NetworkOperationStatusSucceeded NetworkOperationStatus = "Succeeded" -) - -// PossibleNetworkOperationStatusValues returns an array of possible values for the NetworkOperationStatus const type. -func PossibleNetworkOperationStatusValues() []NetworkOperationStatus { - return []NetworkOperationStatus{NetworkOperationStatusFailed, NetworkOperationStatusInProgress, NetworkOperationStatusSucceeded} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration ... - OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration OdataType = "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration" - // OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration ... - OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration OdataType = "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration" - // OdataTypeRouteConfiguration ... - OdataTypeRouteConfiguration OdataType = "RouteConfiguration" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration, OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration, OdataTypeRouteConfiguration} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorAny ... - OperatorAny Operator = "Any" - // OperatorBeginsWith ... - OperatorBeginsWith Operator = "BeginsWith" - // OperatorContains ... - OperatorContains Operator = "Contains" - // OperatorEndsWith ... - OperatorEndsWith Operator = "EndsWith" - // OperatorEqual ... - OperatorEqual Operator = "Equal" - // OperatorGeoMatch ... - OperatorGeoMatch Operator = "GeoMatch" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorIPMatch ... - OperatorIPMatch Operator = "IPMatch" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorRegEx ... - OperatorRegEx Operator = "RegEx" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorAny, OperatorBeginsWith, OperatorContains, OperatorEndsWith, OperatorEqual, OperatorGeoMatch, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorIPMatch, OperatorLessThan, OperatorLessThanOrEqual, OperatorRegEx} -} - -// PolicyEnabledState enumerates the values for policy enabled state. -type PolicyEnabledState string - -const ( - // PolicyEnabledStateDisabled ... - PolicyEnabledStateDisabled PolicyEnabledState = "Disabled" - // PolicyEnabledStateEnabled ... - PolicyEnabledStateEnabled PolicyEnabledState = "Enabled" -) - -// PossiblePolicyEnabledStateValues returns an array of possible values for the PolicyEnabledState const type. -func PossiblePolicyEnabledStateValues() []PolicyEnabledState { - return []PolicyEnabledState{PolicyEnabledStateDisabled, PolicyEnabledStateEnabled} -} - -// PolicyMode enumerates the values for policy mode. -type PolicyMode string - -const ( - // PolicyModeDetection ... - PolicyModeDetection PolicyMode = "Detection" - // PolicyModePrevention ... - PolicyModePrevention PolicyMode = "Prevention" -) - -// PossiblePolicyModeValues returns an array of possible values for the PolicyMode const type. -func PossiblePolicyModeValues() []PolicyMode { - return []PolicyMode{PolicyModeDetection, PolicyModePrevention} -} - -// PolicyRequestBodyCheck enumerates the values for policy request body check. -type PolicyRequestBodyCheck string - -const ( - // PolicyRequestBodyCheckDisabled ... - PolicyRequestBodyCheckDisabled PolicyRequestBodyCheck = "Disabled" - // PolicyRequestBodyCheckEnabled ... - PolicyRequestBodyCheckEnabled PolicyRequestBodyCheck = "Enabled" -) - -// PossiblePolicyRequestBodyCheckValues returns an array of possible values for the PolicyRequestBodyCheck const type. -func PossiblePolicyRequestBodyCheckValues() []PolicyRequestBodyCheck { - return []PolicyRequestBodyCheck{PolicyRequestBodyCheckDisabled, PolicyRequestBodyCheckEnabled} -} - -// PolicyResourceState enumerates the values for policy resource state. -type PolicyResourceState string - -const ( - // PolicyResourceStateCreating ... - PolicyResourceStateCreating PolicyResourceState = "Creating" - // PolicyResourceStateDeleting ... - PolicyResourceStateDeleting PolicyResourceState = "Deleting" - // PolicyResourceStateDisabled ... - PolicyResourceStateDisabled PolicyResourceState = "Disabled" - // PolicyResourceStateDisabling ... - PolicyResourceStateDisabling PolicyResourceState = "Disabling" - // PolicyResourceStateEnabled ... - PolicyResourceStateEnabled PolicyResourceState = "Enabled" - // PolicyResourceStateEnabling ... - PolicyResourceStateEnabling PolicyResourceState = "Enabling" -) - -// PossiblePolicyResourceStateValues returns an array of possible values for the PolicyResourceState const type. -func PossiblePolicyResourceStateValues() []PolicyResourceState { - return []PolicyResourceState{PolicyResourceStateCreating, PolicyResourceStateDeleting, PolicyResourceStateDisabled, PolicyResourceStateDisabling, PolicyResourceStateEnabled, PolicyResourceStateEnabling} -} - -// PrivateEndpointStatus enumerates the values for private endpoint status. -type PrivateEndpointStatus string - -const ( - // PrivateEndpointStatusApproved ... - PrivateEndpointStatusApproved PrivateEndpointStatus = "Approved" - // PrivateEndpointStatusDisconnected ... - PrivateEndpointStatusDisconnected PrivateEndpointStatus = "Disconnected" - // PrivateEndpointStatusPending ... - PrivateEndpointStatusPending PrivateEndpointStatus = "Pending" - // PrivateEndpointStatusRejected ... - PrivateEndpointStatusRejected PrivateEndpointStatus = "Rejected" - // PrivateEndpointStatusTimeout ... - PrivateEndpointStatusTimeout PrivateEndpointStatus = "Timeout" -) - -// PossiblePrivateEndpointStatusValues returns an array of possible values for the PrivateEndpointStatus const type. -func PossiblePrivateEndpointStatusValues() []PrivateEndpointStatus { - return []PrivateEndpointStatus{PrivateEndpointStatusApproved, PrivateEndpointStatusDisconnected, PrivateEndpointStatusPending, PrivateEndpointStatusRejected, PrivateEndpointStatusTimeout} -} - -// Protocol enumerates the values for protocol. -type Protocol string - -const ( - // ProtocolHTTP ... - ProtocolHTTP Protocol = "Http" - // ProtocolHTTPS ... - ProtocolHTTPS Protocol = "Https" -) - -// PossibleProtocolValues returns an array of possible values for the Protocol const type. -func PossibleProtocolValues() []Protocol { - return []Protocol{ProtocolHTTP, ProtocolHTTPS} -} - -// Query enumerates the values for query. -type Query string - -const ( - // QueryStripAll ... - QueryStripAll Query = "StripAll" - // QueryStripAllExcept ... - QueryStripAllExcept Query = "StripAllExcept" - // QueryStripNone ... - QueryStripNone Query = "StripNone" - // QueryStripOnly ... - QueryStripOnly Query = "StripOnly" -) - -// PossibleQueryValues returns an array of possible values for the Query const type. -func PossibleQueryValues() []Query { - return []Query{QueryStripAll, QueryStripAllExcept, QueryStripNone, QueryStripOnly} -} - -// RedirectProtocol enumerates the values for redirect protocol. -type RedirectProtocol string - -const ( - // RedirectProtocolHTTPOnly ... - RedirectProtocolHTTPOnly RedirectProtocol = "HttpOnly" - // RedirectProtocolHTTPSOnly ... - RedirectProtocolHTTPSOnly RedirectProtocol = "HttpsOnly" - // RedirectProtocolMatchRequest ... - RedirectProtocolMatchRequest RedirectProtocol = "MatchRequest" -) - -// PossibleRedirectProtocolValues returns an array of possible values for the RedirectProtocol const type. -func PossibleRedirectProtocolValues() []RedirectProtocol { - return []RedirectProtocol{RedirectProtocolHTTPOnly, RedirectProtocolHTTPSOnly, RedirectProtocolMatchRequest} -} - -// RedirectType enumerates the values for redirect type. -type RedirectType string - -const ( - // RedirectTypeFound ... - RedirectTypeFound RedirectType = "Found" - // RedirectTypeMoved ... - RedirectTypeMoved RedirectType = "Moved" - // RedirectTypePermanentRedirect ... - RedirectTypePermanentRedirect RedirectType = "PermanentRedirect" - // RedirectTypeTemporaryRedirect ... - RedirectTypeTemporaryRedirect RedirectType = "TemporaryRedirect" -) - -// PossibleRedirectTypeValues returns an array of possible values for the RedirectType const type. -func PossibleRedirectTypeValues() []RedirectType { - return []RedirectType{RedirectTypeFound, RedirectTypeMoved, RedirectTypePermanentRedirect, RedirectTypeTemporaryRedirect} -} - -// ResourceState enumerates the values for resource state. -type ResourceState string - -const ( - // ResourceStateCreating ... - ResourceStateCreating ResourceState = "Creating" - // ResourceStateDeleting ... - ResourceStateDeleting ResourceState = "Deleting" - // ResourceStateDisabled ... - ResourceStateDisabled ResourceState = "Disabled" - // ResourceStateDisabling ... - ResourceStateDisabling ResourceState = "Disabling" - // ResourceStateEnabled ... - ResourceStateEnabled ResourceState = "Enabled" - // ResourceStateEnabling ... - ResourceStateEnabling ResourceState = "Enabling" -) - -// PossibleResourceStateValues returns an array of possible values for the ResourceState const type. -func PossibleResourceStateValues() []ResourceState { - return []ResourceState{ResourceStateCreating, ResourceStateDeleting, ResourceStateDisabled, ResourceStateDisabling, ResourceStateEnabled, ResourceStateEnabling} -} - -// ResourceType enumerates the values for resource type. -type ResourceType string - -const ( - // ResourceTypeMicrosoftNetworkfrontDoors ... - ResourceTypeMicrosoftNetworkfrontDoors ResourceType = "Microsoft.Network/frontDoors" - // ResourceTypeMicrosoftNetworkfrontDoorsfrontendEndpoints ... - ResourceTypeMicrosoftNetworkfrontDoorsfrontendEndpoints ResourceType = "Microsoft.Network/frontDoors/frontendEndpoints" -) - -// PossibleResourceTypeValues returns an array of possible values for the ResourceType const type. -func PossibleResourceTypeValues() []ResourceType { - return []ResourceType{ResourceTypeMicrosoftNetworkfrontDoors, ResourceTypeMicrosoftNetworkfrontDoorsfrontendEndpoints} -} - -// RoutingRuleEnabledState enumerates the values for routing rule enabled state. -type RoutingRuleEnabledState string - -const ( - // RoutingRuleEnabledStateDisabled ... - RoutingRuleEnabledStateDisabled RoutingRuleEnabledState = "Disabled" - // RoutingRuleEnabledStateEnabled ... - RoutingRuleEnabledStateEnabled RoutingRuleEnabledState = "Enabled" -) - -// PossibleRoutingRuleEnabledStateValues returns an array of possible values for the RoutingRuleEnabledState const type. -func PossibleRoutingRuleEnabledStateValues() []RoutingRuleEnabledState { - return []RoutingRuleEnabledState{RoutingRuleEnabledStateDisabled, RoutingRuleEnabledStateEnabled} -} - -// RulesEngineMatchVariable enumerates the values for rules engine match variable. -type RulesEngineMatchVariable string - -const ( - // RulesEngineMatchVariableIsMobile ... - RulesEngineMatchVariableIsMobile RulesEngineMatchVariable = "IsMobile" - // RulesEngineMatchVariablePostArgs ... - RulesEngineMatchVariablePostArgs RulesEngineMatchVariable = "PostArgs" - // RulesEngineMatchVariableQueryString ... - RulesEngineMatchVariableQueryString RulesEngineMatchVariable = "QueryString" - // RulesEngineMatchVariableRemoteAddr ... - RulesEngineMatchVariableRemoteAddr RulesEngineMatchVariable = "RemoteAddr" - // RulesEngineMatchVariableRequestBody ... - RulesEngineMatchVariableRequestBody RulesEngineMatchVariable = "RequestBody" - // RulesEngineMatchVariableRequestFilename ... - RulesEngineMatchVariableRequestFilename RulesEngineMatchVariable = "RequestFilename" - // RulesEngineMatchVariableRequestFilenameExtension ... - RulesEngineMatchVariableRequestFilenameExtension RulesEngineMatchVariable = "RequestFilenameExtension" - // RulesEngineMatchVariableRequestHeader ... - RulesEngineMatchVariableRequestHeader RulesEngineMatchVariable = "RequestHeader" - // RulesEngineMatchVariableRequestMethod ... - RulesEngineMatchVariableRequestMethod RulesEngineMatchVariable = "RequestMethod" - // RulesEngineMatchVariableRequestPath ... - RulesEngineMatchVariableRequestPath RulesEngineMatchVariable = "RequestPath" - // RulesEngineMatchVariableRequestScheme ... - RulesEngineMatchVariableRequestScheme RulesEngineMatchVariable = "RequestScheme" - // RulesEngineMatchVariableRequestURI ... - RulesEngineMatchVariableRequestURI RulesEngineMatchVariable = "RequestUri" -) - -// PossibleRulesEngineMatchVariableValues returns an array of possible values for the RulesEngineMatchVariable const type. -func PossibleRulesEngineMatchVariableValues() []RulesEngineMatchVariable { - return []RulesEngineMatchVariable{RulesEngineMatchVariableIsMobile, RulesEngineMatchVariablePostArgs, RulesEngineMatchVariableQueryString, RulesEngineMatchVariableRemoteAddr, RulesEngineMatchVariableRequestBody, RulesEngineMatchVariableRequestFilename, RulesEngineMatchVariableRequestFilenameExtension, RulesEngineMatchVariableRequestHeader, RulesEngineMatchVariableRequestMethod, RulesEngineMatchVariableRequestPath, RulesEngineMatchVariableRequestScheme, RulesEngineMatchVariableRequestURI} -} - -// RulesEngineOperator enumerates the values for rules engine operator. -type RulesEngineOperator string - -const ( - // RulesEngineOperatorAny ... - RulesEngineOperatorAny RulesEngineOperator = "Any" - // RulesEngineOperatorBeginsWith ... - RulesEngineOperatorBeginsWith RulesEngineOperator = "BeginsWith" - // RulesEngineOperatorContains ... - RulesEngineOperatorContains RulesEngineOperator = "Contains" - // RulesEngineOperatorEndsWith ... - RulesEngineOperatorEndsWith RulesEngineOperator = "EndsWith" - // RulesEngineOperatorEqual ... - RulesEngineOperatorEqual RulesEngineOperator = "Equal" - // RulesEngineOperatorGeoMatch ... - RulesEngineOperatorGeoMatch RulesEngineOperator = "GeoMatch" - // RulesEngineOperatorGreaterThan ... - RulesEngineOperatorGreaterThan RulesEngineOperator = "GreaterThan" - // RulesEngineOperatorGreaterThanOrEqual ... - RulesEngineOperatorGreaterThanOrEqual RulesEngineOperator = "GreaterThanOrEqual" - // RulesEngineOperatorIPMatch ... - RulesEngineOperatorIPMatch RulesEngineOperator = "IPMatch" - // RulesEngineOperatorLessThan ... - RulesEngineOperatorLessThan RulesEngineOperator = "LessThan" - // RulesEngineOperatorLessThanOrEqual ... - RulesEngineOperatorLessThanOrEqual RulesEngineOperator = "LessThanOrEqual" -) - -// PossibleRulesEngineOperatorValues returns an array of possible values for the RulesEngineOperator const type. -func PossibleRulesEngineOperatorValues() []RulesEngineOperator { - return []RulesEngineOperator{RulesEngineOperatorAny, RulesEngineOperatorBeginsWith, RulesEngineOperatorContains, RulesEngineOperatorEndsWith, RulesEngineOperatorEqual, RulesEngineOperatorGeoMatch, RulesEngineOperatorGreaterThan, RulesEngineOperatorGreaterThanOrEqual, RulesEngineOperatorIPMatch, RulesEngineOperatorLessThan, RulesEngineOperatorLessThanOrEqual} -} - -// RuleType enumerates the values for rule type. -type RuleType string - -const ( - // RuleTypeMatchRule ... - RuleTypeMatchRule RuleType = "MatchRule" - // RuleTypeRateLimitRule ... - RuleTypeRateLimitRule RuleType = "RateLimitRule" -) - -// PossibleRuleTypeValues returns an array of possible values for the RuleType const type. -func PossibleRuleTypeValues() []RuleType { - return []RuleType{RuleTypeMatchRule, RuleTypeRateLimitRule} -} - -// SessionAffinityEnabledState enumerates the values for session affinity enabled state. -type SessionAffinityEnabledState string - -const ( - // SessionAffinityEnabledStateDisabled ... - SessionAffinityEnabledStateDisabled SessionAffinityEnabledState = "Disabled" - // SessionAffinityEnabledStateEnabled ... - SessionAffinityEnabledStateEnabled SessionAffinityEnabledState = "Enabled" -) - -// PossibleSessionAffinityEnabledStateValues returns an array of possible values for the SessionAffinityEnabledState const type. -func PossibleSessionAffinityEnabledStateValues() []SessionAffinityEnabledState { - return []SessionAffinityEnabledState{SessionAffinityEnabledStateDisabled, SessionAffinityEnabledStateEnabled} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameClassicAzureFrontDoor ... - SkuNameClassicAzureFrontDoor SkuName = "Classic_AzureFrontDoor" - // SkuNamePremiumAzureFrontDoor ... - SkuNamePremiumAzureFrontDoor SkuName = "Premium_AzureFrontDoor" - // SkuNameStandardAzureFrontDoor ... - SkuNameStandardAzureFrontDoor SkuName = "Standard_AzureFrontDoor" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameClassicAzureFrontDoor, SkuNamePremiumAzureFrontDoor, SkuNameStandardAzureFrontDoor} -} - -// State enumerates the values for state. -type State string - -const ( - // StateDisabled ... - StateDisabled State = "Disabled" - // StateEnabled ... - StateEnabled State = "Enabled" -) - -// PossibleStateValues returns an array of possible values for the State const type. -func PossibleStateValues() []State { - return []State{StateDisabled, StateEnabled} -} - -// TimeseriesAggregationInterval enumerates the values for timeseries aggregation interval. -type TimeseriesAggregationInterval string - -const ( - // TimeseriesAggregationIntervalDaily ... - TimeseriesAggregationIntervalDaily TimeseriesAggregationInterval = "Daily" - // TimeseriesAggregationIntervalHourly ... - TimeseriesAggregationIntervalHourly TimeseriesAggregationInterval = "Hourly" -) - -// PossibleTimeseriesAggregationIntervalValues returns an array of possible values for the TimeseriesAggregationInterval const type. -func PossibleTimeseriesAggregationIntervalValues() []TimeseriesAggregationInterval { - return []TimeseriesAggregationInterval{TimeseriesAggregationIntervalDaily, TimeseriesAggregationIntervalHourly} -} - -// TimeseriesType enumerates the values for timeseries type. -type TimeseriesType string - -const ( - // TimeseriesTypeLatencyP50 ... - TimeseriesTypeLatencyP50 TimeseriesType = "LatencyP50" - // TimeseriesTypeLatencyP75 ... - TimeseriesTypeLatencyP75 TimeseriesType = "LatencyP75" - // TimeseriesTypeLatencyP95 ... - TimeseriesTypeLatencyP95 TimeseriesType = "LatencyP95" - // TimeseriesTypeMeasurementCounts ... - TimeseriesTypeMeasurementCounts TimeseriesType = "MeasurementCounts" -) - -// PossibleTimeseriesTypeValues returns an array of possible values for the TimeseriesType const type. -func PossibleTimeseriesTypeValues() []TimeseriesType { - return []TimeseriesType{TimeseriesTypeLatencyP50, TimeseriesTypeLatencyP75, TimeseriesTypeLatencyP95, TimeseriesTypeMeasurementCounts} -} - -// Transform enumerates the values for transform. -type Transform string - -const ( - // TransformLowercase ... - TransformLowercase Transform = "Lowercase" - // TransformRemoveNulls ... - TransformRemoveNulls Transform = "RemoveNulls" - // TransformTrim ... - TransformTrim Transform = "Trim" - // TransformUppercase ... - TransformUppercase Transform = "Uppercase" - // TransformURLDecode ... - TransformURLDecode Transform = "UrlDecode" - // TransformURLEncode ... - TransformURLEncode Transform = "UrlEncode" -) - -// PossibleTransformValues returns an array of possible values for the Transform const type. -func PossibleTransformValues() []Transform { - return []Transform{TransformLowercase, TransformRemoveNulls, TransformTrim, TransformUppercase, TransformURLDecode, TransformURLEncode} -} - -// TransformType enumerates the values for transform type. -type TransformType string - -const ( - // TransformTypeLowercase ... - TransformTypeLowercase TransformType = "Lowercase" - // TransformTypeRemoveNulls ... - TransformTypeRemoveNulls TransformType = "RemoveNulls" - // TransformTypeTrim ... - TransformTypeTrim TransformType = "Trim" - // TransformTypeUppercase ... - TransformTypeUppercase TransformType = "Uppercase" - // TransformTypeURLDecode ... - TransformTypeURLDecode TransformType = "UrlDecode" - // TransformTypeURLEncode ... - TransformTypeURLEncode TransformType = "UrlEncode" -) - -// PossibleTransformTypeValues returns an array of possible values for the TransformType const type. -func PossibleTransformTypeValues() []TransformType { - return []TransformType{TransformTypeLowercase, TransformTypeRemoveNulls, TransformTypeTrim, TransformTypeUppercase, TransformTypeURLDecode, TransformTypeURLEncode} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/experiments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/experiments.go deleted file mode 100644 index bad6eb0c780f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/experiments.go +++ /dev/null @@ -1,534 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ExperimentsClient is the frontDoor Client -type ExperimentsClient struct { - BaseClient -} - -// NewExperimentsClient creates an instance of the ExperimentsClient client. -func NewExperimentsClient(subscriptionID string) ExperimentsClient { - return NewExperimentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExperimentsClientWithBaseURI creates an instance of the ExperimentsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewExperimentsClientWithBaseURI(baseURI string, subscriptionID string) ExperimentsClient { - return ExperimentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -// experimentName - the Experiment identifier associated with the Experiment -// parameters - the Experiment resource -func (client ExperimentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, profileName string, experimentName string, parameters Experiment) (result ExperimentsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: experimentName, - Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.ExperimentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, profileName, experimentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExperimentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string, parameters Experiment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "experimentName": autorest.Encode("path", experimentName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ExperimentsClient) CreateOrUpdateSender(req *http.Request) (future ExperimentsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ExperimentsClient) CreateOrUpdateResponder(resp *http.Response) (result Experiment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete sends the delete request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -// experimentName - the Experiment identifier associated with the Experiment -func (client ExperimentsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, experimentName string) (result ExperimentsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: experimentName, - Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.ExperimentsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, experimentName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ExperimentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "experimentName": autorest.Encode("path", experimentName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ExperimentsClient) DeleteSender(req *http.Request) (future ExperimentsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ExperimentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -// experimentName - the Experiment identifier associated with the Experiment -func (client ExperimentsClient) Get(ctx context.Context, resourceGroupName string, profileName string, experimentName string) (result Experiment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: experimentName, - Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.ExperimentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, profileName, experimentName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExperimentsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "experimentName": autorest.Encode("path", experimentName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ExperimentsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ExperimentsClient) GetResponder(resp *http.Response) (result Experiment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByProfile sends the list by profile request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -func (client ExperimentsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result ExperimentListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.ListByProfile") - defer func() { - sc := -1 - if result.el.Response.Response != nil { - sc = result.el.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.ExperimentsClient", "ListByProfile", err.Error()) - } - - result.fn = client.listByProfileNextResults - req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "ListByProfile", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProfileSender(req) - if err != nil { - result.el.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "ListByProfile", resp, "Failure sending request") - return - } - - result.el, err = client.ListByProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "ListByProfile", resp, "Failure responding to request") - return - } - if result.el.hasNextLink() && result.el.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProfilePreparer prepares the ListByProfile request. -func (client ExperimentsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProfileSender sends the ListByProfile request. The method will close the -// http.Response Body if it receives an error. -func (client ExperimentsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProfileResponder handles the response to the ListByProfile request. The method always -// closes the http.Response Body. -func (client ExperimentsClient) ListByProfileResponder(resp *http.Response) (result ExperimentList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProfileNextResults retrieves the next set of results, if any. -func (client ExperimentsClient) listByProfileNextResults(ctx context.Context, lastResults ExperimentList) (result ExperimentList, err error) { - req, err := lastResults.experimentListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "listByProfileNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProfileSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "listByProfileNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "listByProfileNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExperimentsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result ExperimentListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.ListByProfile") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) - return -} - -// Update updates an Experiment -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -// experimentName - the Experiment identifier associated with the Experiment -// parameters - the Experiment Update Model -func (client ExperimentsClient) Update(ctx context.Context, resourceGroupName string, profileName string, experimentName string, parameters ExperimentUpdateModel) (result ExperimentsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: experimentName, - Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.ExperimentsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, experimentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ExperimentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string, parameters ExperimentUpdateModel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "experimentName": autorest.Encode("path", experimentName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ExperimentsClient) UpdateSender(req *http.Request) (future ExperimentsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ExperimentsClient) UpdateResponder(resp *http.Response) (result Experiment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontdoors.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontdoors.go deleted file mode 100644 index 903e1eae2460..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontdoors.go +++ /dev/null @@ -1,635 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// FrontDoorsClient is the frontDoor Client -type FrontDoorsClient struct { - BaseClient -} - -// NewFrontDoorsClient creates an instance of the FrontDoorsClient client. -func NewFrontDoorsClient(subscriptionID string) FrontDoorsClient { - return NewFrontDoorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFrontDoorsClientWithBaseURI creates an instance of the FrontDoorsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewFrontDoorsClientWithBaseURI(baseURI string, subscriptionID string) FrontDoorsClient { - return FrontDoorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Front Door with a Front Door name under the specified subscription and resource group. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -// frontDoorParameters - front Door properties needed to create a new Front Door. -func (client FrontDoorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, frontDoorName string, frontDoorParameters FrontDoor) (result FrontDoorsCreateOrUpdateFutureType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.FrontDoorsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, frontDoorName, frontDoorParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FrontDoorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, frontDoorName string, frontDoorParameters FrontDoor) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}", pathParameters), - autorest.WithJSON(frontDoorParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FrontDoorsClient) CreateOrUpdateSender(req *http.Request) (future FrontDoorsCreateOrUpdateFutureType, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FrontDoorsClient) CreateOrUpdateResponder(resp *http.Response) (result FrontDoor, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing Front Door with the specified parameters. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -func (client FrontDoorsClient) Delete(ctx context.Context, resourceGroupName string, frontDoorName string) (result FrontDoorsDeleteFutureType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.FrontDoorsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, frontDoorName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FrontDoorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, frontDoorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FrontDoorsClient) DeleteSender(req *http.Request) (future FrontDoorsDeleteFutureType, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FrontDoorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a Front Door with the specified Front Door name under the specified subscription and resource group. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -func (client FrontDoorsClient) Get(ctx context.Context, resourceGroupName string, frontDoorName string) (result FrontDoor, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.FrontDoorsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, frontDoorName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FrontDoorsClient) GetPreparer(ctx context.Context, resourceGroupName string, frontDoorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FrontDoorsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FrontDoorsClient) GetResponder(resp *http.Response) (result FrontDoor, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the Front Doors within an Azure subscription. -func (client FrontDoorsClient) List(ctx context.Context) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.List") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "List", resp, "Failure sending request") - return - } - - result.lr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "List", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client FrontDoorsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client FrontDoorsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client FrontDoorsClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client FrontDoorsClient) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client FrontDoorsClient) ListComplete(ctx context.Context) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup lists all of the Front Doors within a resource group under a subscription. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -func (client FrontDoorsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.FrontDoorsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.lr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client FrontDoorsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client FrontDoorsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client FrontDoorsClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client FrontDoorsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client FrontDoorsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ValidateCustomDomain validates the custom domain mapping to ensure it maps to the correct Front Door endpoint in -// DNS. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -// customDomainProperties - custom domain to be validated. -func (client FrontDoorsClient) ValidateCustomDomain(ctx context.Context, resourceGroupName string, frontDoorName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.ValidateCustomDomain") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, - {TargetValue: customDomainProperties, - Constraints: []validation.Constraint{{Target: "customDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.FrontDoorsClient", "ValidateCustomDomain", err.Error()) - } - - req, err := client.ValidateCustomDomainPreparer(ctx, resourceGroupName, frontDoorName, customDomainProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ValidateCustomDomain", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateCustomDomainSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ValidateCustomDomain", resp, "Failure sending request") - return - } - - result, err = client.ValidateCustomDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ValidateCustomDomain", resp, "Failure responding to request") - return - } - - return -} - -// ValidateCustomDomainPreparer prepares the ValidateCustomDomain request. -func (client FrontDoorsClient) ValidateCustomDomainPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, customDomainProperties ValidateCustomDomainInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/validateCustomDomain", pathParameters), - autorest.WithJSON(customDomainProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateCustomDomainSender sends the ValidateCustomDomain request. The method will close the -// http.Response Body if it receives an error. -func (client FrontDoorsClient) ValidateCustomDomainSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ValidateCustomDomainResponder handles the response to the ValidateCustomDomain request. The method always -// closes the http.Response Body. -func (client FrontDoorsClient) ValidateCustomDomainResponder(resp *http.Response) (result ValidateCustomDomainOutput, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontendendpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontendendpoints.go deleted file mode 100644 index 928b44b7c7cc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontendendpoints.go +++ /dev/null @@ -1,454 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// FrontendEndpointsClient is the frontDoor Client -type FrontendEndpointsClient struct { - BaseClient -} - -// NewFrontendEndpointsClient creates an instance of the FrontendEndpointsClient client. -func NewFrontendEndpointsClient(subscriptionID string) FrontendEndpointsClient { - return NewFrontendEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFrontendEndpointsClientWithBaseURI creates an instance of the FrontendEndpointsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewFrontendEndpointsClientWithBaseURI(baseURI string, subscriptionID string) FrontendEndpointsClient { - return FrontendEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// DisableHTTPS disables a frontendEndpoint for HTTPS traffic -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -// frontendEndpointName - name of the Frontend endpoint which is unique within the Front Door. -func (client FrontendEndpointsClient) DisableHTTPS(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string) (result FrontendEndpointsDisableHTTPSFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.DisableHTTPS") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, - {TargetValue: frontendEndpointName, - Constraints: []validation.Constraint{{Target: "frontendEndpointName", Name: validation.MaxLength, Rule: 255, Chain: nil}, - {Target: "frontendEndpointName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "frontendEndpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.FrontendEndpointsClient", "DisableHTTPS", err.Error()) - } - - req, err := client.DisableHTTPSPreparer(ctx, resourceGroupName, frontDoorName, frontendEndpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "DisableHTTPS", nil, "Failure preparing request") - return - } - - result, err = client.DisableHTTPSSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "DisableHTTPS", result.Response(), "Failure sending request") - return - } - - return -} - -// DisableHTTPSPreparer prepares the DisableHTTPS request. -func (client FrontendEndpointsClient) DisableHTTPSPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "frontendEndpointName": autorest.Encode("path", frontendEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/disableHttps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableHTTPSSender sends the DisableHTTPS request. The method will close the -// http.Response Body if it receives an error. -func (client FrontendEndpointsClient) DisableHTTPSSender(req *http.Request) (future FrontendEndpointsDisableHTTPSFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DisableHTTPSResponder handles the response to the DisableHTTPS request. The method always -// closes the http.Response Body. -func (client FrontendEndpointsClient) DisableHTTPSResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// EnableHTTPS enables a frontendEndpoint for HTTPS traffic -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -// frontendEndpointName - name of the Frontend endpoint which is unique within the Front Door. -// customHTTPSConfiguration - the configuration specifying how to enable HTTPS -func (client FrontendEndpointsClient) EnableHTTPS(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string, customHTTPSConfiguration CustomHTTPSConfiguration) (result FrontendEndpointsEnableHTTPSFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.EnableHTTPS") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, - {TargetValue: frontendEndpointName, - Constraints: []validation.Constraint{{Target: "frontendEndpointName", Name: validation.MaxLength, Rule: 255, Chain: nil}, - {Target: "frontendEndpointName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "frontendEndpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}, - {TargetValue: customHTTPSConfiguration, - Constraints: []validation.Constraint{{Target: "customHTTPSConfiguration.ProtocolType", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.FrontendEndpointsClient", "EnableHTTPS", err.Error()) - } - - req, err := client.EnableHTTPSPreparer(ctx, resourceGroupName, frontDoorName, frontendEndpointName, customHTTPSConfiguration) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "EnableHTTPS", nil, "Failure preparing request") - return - } - - result, err = client.EnableHTTPSSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "EnableHTTPS", result.Response(), "Failure sending request") - return - } - - return -} - -// EnableHTTPSPreparer prepares the EnableHTTPS request. -func (client FrontendEndpointsClient) EnableHTTPSPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string, customHTTPSConfiguration CustomHTTPSConfiguration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "frontendEndpointName": autorest.Encode("path", frontendEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/enableHttps", pathParameters), - autorest.WithJSON(customHTTPSConfiguration), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableHTTPSSender sends the EnableHTTPS request. The method will close the -// http.Response Body if it receives an error. -func (client FrontendEndpointsClient) EnableHTTPSSender(req *http.Request) (future FrontendEndpointsEnableHTTPSFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// EnableHTTPSResponder handles the response to the EnableHTTPS request. The method always -// closes the http.Response Body. -func (client FrontendEndpointsClient) EnableHTTPSResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a Frontend endpoint with the specified name within the specified Front Door. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -// frontendEndpointName - name of the Frontend endpoint which is unique within the Front Door. -func (client FrontendEndpointsClient) Get(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string) (result FrontendEndpoint, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, - {TargetValue: frontendEndpointName, - Constraints: []validation.Constraint{{Target: "frontendEndpointName", Name: validation.MaxLength, Rule: 255, Chain: nil}, - {Target: "frontendEndpointName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "frontendEndpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.FrontendEndpointsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, frontDoorName, frontendEndpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FrontendEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "frontendEndpointName": autorest.Encode("path", frontendEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FrontendEndpointsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FrontendEndpointsClient) GetResponder(resp *http.Response) (result FrontendEndpoint, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByFrontDoor lists all of the frontend endpoints within a Front Door. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -func (client FrontendEndpointsClient) ListByFrontDoor(ctx context.Context, resourceGroupName string, frontDoorName string) (result FrontendEndpointsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.ListByFrontDoor") - defer func() { - sc := -1 - if result.felr.Response.Response != nil { - sc = result.felr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.FrontendEndpointsClient", "ListByFrontDoor", err.Error()) - } - - result.fn = client.listByFrontDoorNextResults - req, err := client.ListByFrontDoorPreparer(ctx, resourceGroupName, frontDoorName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "ListByFrontDoor", nil, "Failure preparing request") - return - } - - resp, err := client.ListByFrontDoorSender(req) - if err != nil { - result.felr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "ListByFrontDoor", resp, "Failure sending request") - return - } - - result.felr, err = client.ListByFrontDoorResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "ListByFrontDoor", resp, "Failure responding to request") - return - } - if result.felr.hasNextLink() && result.felr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByFrontDoorPreparer prepares the ListByFrontDoor request. -func (client FrontendEndpointsClient) ListByFrontDoorPreparer(ctx context.Context, resourceGroupName string, frontDoorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByFrontDoorSender sends the ListByFrontDoor request. The method will close the -// http.Response Body if it receives an error. -func (client FrontendEndpointsClient) ListByFrontDoorSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByFrontDoorResponder handles the response to the ListByFrontDoor request. The method always -// closes the http.Response Body. -func (client FrontendEndpointsClient) ListByFrontDoorResponder(resp *http.Response) (result FrontendEndpointsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByFrontDoorNextResults retrieves the next set of results, if any. -func (client FrontendEndpointsClient) listByFrontDoorNextResults(ctx context.Context, lastResults FrontendEndpointsListResult) (result FrontendEndpointsListResult, err error) { - req, err := lastResults.frontendEndpointsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "listByFrontDoorNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByFrontDoorSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "listByFrontDoorNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByFrontDoorResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "listByFrontDoorNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByFrontDoorComplete enumerates all values, automatically crossing page boundaries as required. -func (client FrontendEndpointsClient) ListByFrontDoorComplete(ctx context.Context, resourceGroupName string, frontDoorName string) (result FrontendEndpointsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.ListByFrontDoor") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByFrontDoor(ctx, resourceGroupName, frontDoorName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/managedrulesets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/managedrulesets.go deleted file mode 100644 index 4073568b2ea7..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/managedrulesets.go +++ /dev/null @@ -1,144 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ManagedRuleSetsClient is the frontDoor Client -type ManagedRuleSetsClient struct { - BaseClient -} - -// NewManagedRuleSetsClient creates an instance of the ManagedRuleSetsClient client. -func NewManagedRuleSetsClient(subscriptionID string) ManagedRuleSetsClient { - return NewManagedRuleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedRuleSetsClientWithBaseURI creates an instance of the ManagedRuleSetsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewManagedRuleSetsClientWithBaseURI(baseURI string, subscriptionID string) ManagedRuleSetsClient { - return ManagedRuleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all available managed rule sets. -func (client ManagedRuleSetsClient) List(ctx context.Context) (result ManagedRuleSetDefinitionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetsClient.List") - defer func() { - sc := -1 - if result.mrsdl.Response.Response != nil { - sc = result.mrsdl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.mrsdl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "List", resp, "Failure sending request") - return - } - - result.mrsdl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "List", resp, "Failure responding to request") - return - } - if result.mrsdl.hasNextLink() && result.mrsdl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ManagedRuleSetsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallManagedRuleSets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedRuleSetsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ManagedRuleSetsClient) ListResponder(resp *http.Response) (result ManagedRuleSetDefinitionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ManagedRuleSetsClient) listNextResults(ctx context.Context, lastResults ManagedRuleSetDefinitionList) (result ManagedRuleSetDefinitionList, err error) { - req, err := lastResults.managedRuleSetDefinitionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedRuleSetsClient) ListComplete(ctx context.Context) (result ManagedRuleSetDefinitionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/models.go deleted file mode 100644 index e92b4014c593..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/models.go +++ /dev/null @@ -1,4945 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" - -// AzureAsyncOperationResult the response body contains the status of the specified asynchronous operation, -// indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct -// from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous -// operation succeeded, the response body includes the HTTP status code for the successful request. If the -// asynchronous operation failed, the response body includes the HTTP status code for the failed request -// and error information regarding the failure. -type AzureAsyncOperationResult struct { - // Status - Status of the Azure async operation. Possible values are: 'InProgress', 'Succeeded', and 'Failed'. Possible values include: 'NetworkOperationStatusInProgress', 'NetworkOperationStatusSucceeded', 'NetworkOperationStatusFailed' - Status NetworkOperationStatus `json:"status,omitempty"` - Error *Error `json:"error,omitempty"` -} - -// Backend backend address of a frontDoor load balancer. -type Backend struct { - // Address - Location of the backend (IP address or FQDN) - Address *string `json:"address,omitempty"` - // PrivateLinkAlias - The Alias of the Private Link resource. Populating this optional field indicates that this backend is 'Private' - PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` - // PrivateLinkResourceID - The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private' - PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` - // PrivateLinkLocation - The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated - PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` - // PrivateEndpointStatus - READ-ONLY; The Approval status for the connection to the Private Link. Possible values include: 'PrivateEndpointStatusPending', 'PrivateEndpointStatusApproved', 'PrivateEndpointStatusRejected', 'PrivateEndpointStatusDisconnected', 'PrivateEndpointStatusTimeout' - PrivateEndpointStatus PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` - // PrivateLinkApprovalMessage - A custom message to be included in the approval request to connect to the Private Link - PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` - // HTTPPort - The HTTP TCP port number. Must be between 1 and 65535. - HTTPPort *int32 `json:"httpPort,omitempty"` - // HTTPSPort - The HTTPS TCP port number. Must be between 1 and 65535. - HTTPSPort *int32 `json:"httpsPort,omitempty"` - // EnabledState - Whether to enable use of this backend. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'BackendEnabledStateEnabled', 'BackendEnabledStateDisabled' - EnabledState BackendEnabledState `json:"enabledState,omitempty"` - // Priority - Priority to use for load balancing. Higher priorities will not be used for load balancing if any lower priority backend is healthy. - Priority *int32 `json:"priority,omitempty"` - // Weight - Weight of this endpoint for load balancing purposes. - Weight *int32 `json:"weight,omitempty"` - // BackendHostHeader - The value to use as the host header sent to the backend. If blank or unspecified, this defaults to the incoming host. - BackendHostHeader *string `json:"backendHostHeader,omitempty"` -} - -// MarshalJSON is the custom marshaler for Backend. -func (b Backend) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if b.Address != nil { - objectMap["address"] = b.Address - } - if b.PrivateLinkAlias != nil { - objectMap["privateLinkAlias"] = b.PrivateLinkAlias - } - if b.PrivateLinkResourceID != nil { - objectMap["privateLinkResourceId"] = b.PrivateLinkResourceID - } - if b.PrivateLinkLocation != nil { - objectMap["privateLinkLocation"] = b.PrivateLinkLocation - } - if b.PrivateLinkApprovalMessage != nil { - objectMap["privateLinkApprovalMessage"] = b.PrivateLinkApprovalMessage - } - if b.HTTPPort != nil { - objectMap["httpPort"] = b.HTTPPort - } - if b.HTTPSPort != nil { - objectMap["httpsPort"] = b.HTTPSPort - } - if b.EnabledState != "" { - objectMap["enabledState"] = b.EnabledState - } - if b.Priority != nil { - objectMap["priority"] = b.Priority - } - if b.Weight != nil { - objectMap["weight"] = b.Weight - } - if b.BackendHostHeader != nil { - objectMap["backendHostHeader"] = b.BackendHostHeader - } - return json.Marshal(objectMap) -} - -// BackendPool a backend pool is a collection of backends that can be routed to. -type BackendPool struct { - // BackendPoolProperties - Properties of the Front Door Backend Pool - *BackendPoolProperties `json:"properties,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendPool. -func (bp BackendPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.BackendPoolProperties != nil { - objectMap["properties"] = bp.BackendPoolProperties - } - if bp.Name != nil { - objectMap["name"] = bp.Name - } - if bp.ID != nil { - objectMap["id"] = bp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendPool struct. -func (bp *BackendPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var backendPoolProperties BackendPoolProperties - err = json.Unmarshal(*v, &backendPoolProperties) - if err != nil { - return err - } - bp.BackendPoolProperties = &backendPoolProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bp.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bp.ID = &ID - } - } - } - - return nil -} - -// BackendPoolListResult result of the request to list Backend Pools. It contains a list of Backend Pools -// objects and a URL link to get the next set of results. -type BackendPoolListResult struct { - // Value - READ-ONLY; List of Backend Pools within a Front Door. - Value *[]BackendPool `json:"value,omitempty"` - // NextLink - URL to get the next set of BackendPool objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendPoolListResult. -func (bplr BackendPoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bplr.NextLink != nil { - objectMap["nextLink"] = bplr.NextLink - } - return json.Marshal(objectMap) -} - -// BackendPoolProperties the JSON object that contains the properties required to create a Backend Pool. -type BackendPoolProperties struct { - // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' - ResourceState ResourceState `json:"resourceState,omitempty"` - // Backends - The set of backends for this pool - Backends *[]Backend `json:"backends,omitempty"` - // LoadBalancingSettings - Load balancing settings for a backend pool - LoadBalancingSettings *SubResource `json:"loadBalancingSettings,omitempty"` - // HealthProbeSettings - L7 health probe settings for a backend pool - HealthProbeSettings *SubResource `json:"healthProbeSettings,omitempty"` -} - -// BackendPoolsSettings settings that apply to all backend pools. -type BackendPoolsSettings struct { - // EnforceCertificateNameCheck - Whether to enforce certificate name check on HTTPS requests to all backend pools. No effect on non-HTTPS requests. Possible values include: 'EnforceCertificateNameCheckEnabledStateEnabled', 'EnforceCertificateNameCheckEnabledStateDisabled' - EnforceCertificateNameCheck EnforceCertificateNameCheckEnabledState `json:"enforceCertificateNameCheck,omitempty"` - // SendRecvTimeoutSeconds - Send and receive timeout on forwarding request to the backend. When timeout is reached, the request fails and returns. - SendRecvTimeoutSeconds *int32 `json:"sendRecvTimeoutSeconds,omitempty"` -} - -// BackendPoolUpdateParameters a collection of backends that can be routed to. -type BackendPoolUpdateParameters struct { - // Backends - The set of backends for this pool - Backends *[]Backend `json:"backends,omitempty"` - // LoadBalancingSettings - Load balancing settings for a backend pool - LoadBalancingSettings *SubResource `json:"loadBalancingSettings,omitempty"` - // HealthProbeSettings - L7 health probe settings for a backend pool - HealthProbeSettings *SubResource `json:"healthProbeSettings,omitempty"` -} - -// CacheConfiguration caching settings for a caching-type route. To disable caching, do not provide a -// cacheConfiguration object. -type CacheConfiguration struct { - // QueryParameterStripDirective - Treatment of URL query terms when forming the cache key. Possible values include: 'QueryStripNone', 'QueryStripAll', 'QueryStripOnly', 'QueryStripAllExcept' - QueryParameterStripDirective Query `json:"queryParameterStripDirective,omitempty"` - // QueryParameters - query parameters to include or exclude (comma separated). - QueryParameters *string `json:"queryParameters,omitempty"` - // DynamicCompression - Whether to use dynamic compression for cached content. Possible values include: 'DynamicCompressionEnabledEnabled', 'DynamicCompressionEnabledDisabled' - DynamicCompression DynamicCompressionEnabled `json:"dynamicCompression,omitempty"` - // CacheDuration - The duration for which the content needs to be cached. Allowed format is in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). HTTP requires the value to be no more than a year - CacheDuration *string `json:"cacheDuration,omitempty"` -} - -// CertificateSourceParameters parameters required for enabling SSL with Front Door-managed certificates -type CertificateSourceParameters struct { - // CertificateType - Defines the type of the certificate used for secure connections to a frontendEndpoint. Possible values include: 'CertificateTypeDedicated' - CertificateType CertificateType `json:"certificateType,omitempty"` -} - -// CheckNameAvailabilityInput input of CheckNameAvailability API. -type CheckNameAvailabilityInput struct { - // Name - The resource name to validate. - Name *string `json:"name,omitempty"` - // Type - The type of the resource whose name is to be validated. Possible values include: 'ResourceTypeMicrosoftNetworkfrontDoors', 'ResourceTypeMicrosoftNetworkfrontDoorsfrontendEndpoints' - Type ResourceType `json:"type,omitempty"` -} - -// CheckNameAvailabilityOutput output of check name availability API. -type CheckNameAvailabilityOutput struct { - autorest.Response `json:"-"` - // NameAvailability - READ-ONLY; Indicates whether the name is available. Possible values include: 'AvailabilityAvailable', 'AvailabilityUnavailable' - NameAvailability Availability `json:"nameAvailability,omitempty"` - // Reason - READ-ONLY; The reason why the name is not available. - Reason *string `json:"reason,omitempty"` - // Message - READ-ONLY; The detailed error message describing why the name is not available. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckNameAvailabilityOutput. -func (cnao CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CustomHTTPSConfiguration https settings for a domain -type CustomHTTPSConfiguration struct { - // CertificateSource - Defines the source of the SSL certificate. Possible values include: 'CertificateSourceAzureKeyVault', 'CertificateSourceFrontDoor' - CertificateSource CertificateSource `json:"certificateSource,omitempty"` - // ProtocolType - Defines the TLS extension protocol that is used for secure delivery - ProtocolType *string `json:"protocolType,omitempty"` - // MinimumTLSVersion - The minimum TLS version required from the clients to establish an SSL handshake with Front Door. Possible values include: 'MinimumTLSVersionOneFullStopZero', 'MinimumTLSVersionOneFullStopTwo' - MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` - // KeyVaultCertificateSourceParameters - KeyVault certificate source parameters (if certificateSource=AzureKeyVault) - *KeyVaultCertificateSourceParameters `json:"keyVaultCertificateSourceParameters,omitempty"` - // CertificateSourceParameters - Parameters required for enabling SSL with Front Door-managed certificates (if certificateSource=FrontDoor) - *CertificateSourceParameters `json:"frontDoorCertificateSourceParameters,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomHTTPSConfiguration. -func (chc CustomHTTPSConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if chc.CertificateSource != "" { - objectMap["certificateSource"] = chc.CertificateSource - } - if chc.ProtocolType != nil { - objectMap["protocolType"] = chc.ProtocolType - } - if chc.MinimumTLSVersion != "" { - objectMap["minimumTlsVersion"] = chc.MinimumTLSVersion - } - if chc.KeyVaultCertificateSourceParameters != nil { - objectMap["keyVaultCertificateSourceParameters"] = chc.KeyVaultCertificateSourceParameters - } - if chc.CertificateSourceParameters != nil { - objectMap["frontDoorCertificateSourceParameters"] = chc.CertificateSourceParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CustomHTTPSConfiguration struct. -func (chc *CustomHTTPSConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "certificateSource": - if v != nil { - var certificateSource CertificateSource - err = json.Unmarshal(*v, &certificateSource) - if err != nil { - return err - } - chc.CertificateSource = certificateSource - } - case "protocolType": - if v != nil { - var protocolType string - err = json.Unmarshal(*v, &protocolType) - if err != nil { - return err - } - chc.ProtocolType = &protocolType - } - case "minimumTlsVersion": - if v != nil { - var minimumTLSVersion MinimumTLSVersion - err = json.Unmarshal(*v, &minimumTLSVersion) - if err != nil { - return err - } - chc.MinimumTLSVersion = minimumTLSVersion - } - case "keyVaultCertificateSourceParameters": - if v != nil { - var keyVaultCertificateSourceParameters KeyVaultCertificateSourceParameters - err = json.Unmarshal(*v, &keyVaultCertificateSourceParameters) - if err != nil { - return err - } - chc.KeyVaultCertificateSourceParameters = &keyVaultCertificateSourceParameters - } - case "frontDoorCertificateSourceParameters": - if v != nil { - var certificateSourceParameters CertificateSourceParameters - err = json.Unmarshal(*v, &certificateSourceParameters) - if err != nil { - return err - } - chc.CertificateSourceParameters = &certificateSourceParameters - } - } - } - - return nil -} - -// CustomRule defines contents of a web application rule -type CustomRule struct { - // Name - Describes the name of the rule. - Name *string `json:"name,omitempty"` - // Priority - Describes priority of the rule. Rules with a lower value will be evaluated before rules with a higher value. - Priority *int32 `json:"priority,omitempty"` - // EnabledState - Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: 'CustomRuleEnabledStateDisabled', 'CustomRuleEnabledStateEnabled' - EnabledState CustomRuleEnabledState `json:"enabledState,omitempty"` - // RuleType - Describes type of rule. Possible values include: 'RuleTypeMatchRule', 'RuleTypeRateLimitRule' - RuleType RuleType `json:"ruleType,omitempty"` - // RateLimitDurationInMinutes - Time window for resetting the rate limit count. Default is 1 minute. - RateLimitDurationInMinutes *int32 `json:"rateLimitDurationInMinutes,omitempty"` - // RateLimitThreshold - Number of allowed requests per client within the time window. - RateLimitThreshold *int32 `json:"rateLimitThreshold,omitempty"` - // MatchConditions - List of match conditions. - MatchConditions *[]MatchCondition `json:"matchConditions,omitempty"` - // Action - Describes what action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' - Action ActionType `json:"action,omitempty"` -} - -// CustomRuleList defines contents of custom rules -type CustomRuleList struct { - // Rules - List of rules - Rules *[]CustomRule `json:"rules,omitempty"` -} - -// Endpoint defines the endpoint properties -type Endpoint struct { - // Name - The name of the endpoint - Name *string `json:"name,omitempty"` - // Endpoint - The endpoint URL - Endpoint *string `json:"endpoint,omitempty"` -} - -// EndpointsPurgeContentFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type EndpointsPurgeContentFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EndpointsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EndpointsPurgeContentFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for EndpointsPurgeContentFuture.Result. -func (future *EndpointsPurgeContentFuture) result(client EndpointsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.EndpointsPurgeContentFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.EndpointsPurgeContentFuture") - return - } - ar.Response = future.Response() - return -} - -// Error ... -type Error struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]ErrorDetails `json:"details,omitempty"` - InnerError *string `json:"innerError,omitempty"` -} - -// ErrorDetails ... -type ErrorDetails struct { - Code *string `json:"code,omitempty"` - Target *string `json:"target,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ErrorResponse error response indicates Front Door service is not able to process the incoming request. -// The reason is provided in the error message. -type ErrorResponse struct { - // Code - READ-ONLY; Error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Experiment defines the properties of an Experiment -type Experiment struct { - autorest.Response `json:"-"` - // ExperimentProperties - The properties of an Experiment - *ExperimentProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Experiment. -func (e Experiment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if e.ExperimentProperties != nil { - objectMap["properties"] = e.ExperimentProperties - } - if e.Location != nil { - objectMap["location"] = e.Location - } - if e.Tags != nil { - objectMap["tags"] = e.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Experiment struct. -func (e *Experiment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var experimentProperties ExperimentProperties - err = json.Unmarshal(*v, &experimentProperties) - if err != nil { - return err - } - e.ExperimentProperties = &experimentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - e.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - e.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - e.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - e.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - e.Tags = tags - } - } - } - - return nil -} - -// ExperimentList defines a list of Experiments. It contains a list of Experiment objects and a URL link to -// get the next set of results. -type ExperimentList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Experiments within a resource group. - Value *[]Experiment `json:"value,omitempty"` - // NextLink - URL to get the next set of Experiment objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExperimentList. -func (el ExperimentList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if el.NextLink != nil { - objectMap["nextLink"] = el.NextLink - } - return json.Marshal(objectMap) -} - -// ExperimentListIterator provides access to a complete listing of Experiment values. -type ExperimentListIterator struct { - i int - page ExperimentListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExperimentListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExperimentListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExperimentListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExperimentListIterator) Response() ExperimentList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExperimentListIterator) Value() Experiment { - if !iter.page.NotDone() { - return Experiment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExperimentListIterator type. -func NewExperimentListIterator(page ExperimentListPage) ExperimentListIterator { - return ExperimentListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (el ExperimentList) IsEmpty() bool { - return el.Value == nil || len(*el.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (el ExperimentList) hasNextLink() bool { - return el.NextLink != nil && len(*el.NextLink) != 0 -} - -// experimentListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (el ExperimentList) experimentListPreparer(ctx context.Context) (*http.Request, error) { - if !el.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(el.NextLink))) -} - -// ExperimentListPage contains a page of Experiment values. -type ExperimentListPage struct { - fn func(context.Context, ExperimentList) (ExperimentList, error) - el ExperimentList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExperimentListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.el) - if err != nil { - return err - } - page.el = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExperimentListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExperimentListPage) NotDone() bool { - return !page.el.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExperimentListPage) Response() ExperimentList { - return page.el -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExperimentListPage) Values() []Experiment { - if page.el.IsEmpty() { - return nil - } - return *page.el.Value -} - -// Creates a new instance of the ExperimentListPage type. -func NewExperimentListPage(cur ExperimentList, getNextPage func(context.Context, ExperimentList) (ExperimentList, error)) ExperimentListPage { - return ExperimentListPage{ - fn: getNextPage, - el: cur, - } -} - -// ExperimentProperties defines the properties of an experiment -type ExperimentProperties struct { - // Description - The description of the details or intents of the Experiment - Description *string `json:"description,omitempty"` - // EndpointA - The endpoint A of an experiment - EndpointA *Endpoint `json:"endpointA,omitempty"` - // EndpointB - The endpoint B of an experiment - EndpointB *Endpoint `json:"endpointB,omitempty"` - // EnabledState - The state of the Experiment. Possible values include: 'StateEnabled', 'StateDisabled' - EnabledState State `json:"enabledState,omitempty"` - // ResourceState - Resource status. Possible values include: 'NetworkExperimentResourceStateCreating', 'NetworkExperimentResourceStateEnabling', 'NetworkExperimentResourceStateEnabled', 'NetworkExperimentResourceStateDisabling', 'NetworkExperimentResourceStateDisabled', 'NetworkExperimentResourceStateDeleting' - ResourceState NetworkExperimentResourceState `json:"resourceState,omitempty"` - // Status - READ-ONLY; The description of Experiment status from the server side - Status *string `json:"status,omitempty"` - // ScriptFileURI - READ-ONLY; The uri to the Script used in the Experiment - ScriptFileURI *string `json:"scriptFileUri,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExperimentProperties. -func (ep ExperimentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.Description != nil { - objectMap["description"] = ep.Description - } - if ep.EndpointA != nil { - objectMap["endpointA"] = ep.EndpointA - } - if ep.EndpointB != nil { - objectMap["endpointB"] = ep.EndpointB - } - if ep.EnabledState != "" { - objectMap["enabledState"] = ep.EnabledState - } - if ep.ResourceState != "" { - objectMap["resourceState"] = ep.ResourceState - } - return json.Marshal(objectMap) -} - -// ExperimentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExperimentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExperimentsClient) (Experiment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExperimentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExperimentsCreateOrUpdateFuture.Result. -func (future *ExperimentsCreateOrUpdateFuture) result(client ExperimentsClient) (e Experiment, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - e.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.ExperimentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { - e, err = client.CreateOrUpdateResponder(e.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsCreateOrUpdateFuture", "Result", e.Response.Response, "Failure responding to request") - } - } - return -} - -// ExperimentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExperimentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExperimentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExperimentsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExperimentsDeleteFuture.Result. -func (future *ExperimentsDeleteFuture) result(client ExperimentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.ExperimentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExperimentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExperimentsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExperimentsClient) (Experiment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExperimentsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExperimentsUpdateFuture.Result. -func (future *ExperimentsUpdateFuture) result(client ExperimentsClient) (e Experiment, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - e.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.ExperimentsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { - e, err = client.UpdateResponder(e.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") - } - } - return -} - -// ExperimentUpdateModel defines modifiable attributes of an Experiment -type ExperimentUpdateModel struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ExperimentUpdateProperties - The properties of a Profile - *ExperimentUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExperimentUpdateModel. -func (eum ExperimentUpdateModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eum.Tags != nil { - objectMap["tags"] = eum.Tags - } - if eum.ExperimentUpdateProperties != nil { - objectMap["properties"] = eum.ExperimentUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExperimentUpdateModel struct. -func (eum *ExperimentUpdateModel) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - eum.Tags = tags - } - case "properties": - if v != nil { - var experimentUpdateProperties ExperimentUpdateProperties - err = json.Unmarshal(*v, &experimentUpdateProperties) - if err != nil { - return err - } - eum.ExperimentUpdateProperties = &experimentUpdateProperties - } - } - } - - return nil -} - -// ExperimentUpdateProperties defines the properties of an experiment -type ExperimentUpdateProperties struct { - // Description - The description of the intent or details of the Experiment - Description *string `json:"description,omitempty"` - // EnabledState - The state of the Experiment. Possible values include: 'StateEnabled', 'StateDisabled' - EnabledState State `json:"enabledState,omitempty"` -} - -// ForwardingConfiguration describes Forwarding Route. -type ForwardingConfiguration struct { - // CustomForwardingPath - A custom path used to rewrite resource paths matched by this rule. Leave empty to use incoming path. - CustomForwardingPath *string `json:"customForwardingPath,omitempty"` - // ForwardingProtocol - Protocol this rule will use when forwarding traffic to backends. Possible values include: 'ForwardingProtocolHTTPOnly', 'ForwardingProtocolHTTPSOnly', 'ForwardingProtocolMatchRequest' - ForwardingProtocol ForwardingProtocol `json:"forwardingProtocol,omitempty"` - // CacheConfiguration - The caching configuration associated with this rule. - CacheConfiguration *CacheConfiguration `json:"cacheConfiguration,omitempty"` - // BackendPool - A reference to the BackendPool which this rule routes to. - BackendPool *SubResource `json:"backendPool,omitempty"` - // OdataType - Possible values include: 'OdataTypeRouteConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration' - OdataType OdataType `json:"@odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ForwardingConfiguration. -func (fc ForwardingConfiguration) MarshalJSON() ([]byte, error) { - fc.OdataType = OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration - objectMap := make(map[string]interface{}) - if fc.CustomForwardingPath != nil { - objectMap["customForwardingPath"] = fc.CustomForwardingPath - } - if fc.ForwardingProtocol != "" { - objectMap["forwardingProtocol"] = fc.ForwardingProtocol - } - if fc.CacheConfiguration != nil { - objectMap["cacheConfiguration"] = fc.CacheConfiguration - } - if fc.BackendPool != nil { - objectMap["backendPool"] = fc.BackendPool - } - if fc.OdataType != "" { - objectMap["@odata.type"] = fc.OdataType - } - return json.Marshal(objectMap) -} - -// AsForwardingConfiguration is the BasicRouteConfiguration implementation for ForwardingConfiguration. -func (fc ForwardingConfiguration) AsForwardingConfiguration() (*ForwardingConfiguration, bool) { - return &fc, true -} - -// AsRedirectConfiguration is the BasicRouteConfiguration implementation for ForwardingConfiguration. -func (fc ForwardingConfiguration) AsRedirectConfiguration() (*RedirectConfiguration, bool) { - return nil, false -} - -// AsRouteConfiguration is the BasicRouteConfiguration implementation for ForwardingConfiguration. -func (fc ForwardingConfiguration) AsRouteConfiguration() (*RouteConfiguration, bool) { - return nil, false -} - -// AsBasicRouteConfiguration is the BasicRouteConfiguration implementation for ForwardingConfiguration. -func (fc ForwardingConfiguration) AsBasicRouteConfiguration() (BasicRouteConfiguration, bool) { - return &fc, true -} - -// FrontDoor front Door represents a collection of backend endpoints to route traffic to along with rules -// that specify how traffic is sent there. -type FrontDoor struct { - autorest.Response `json:"-"` - // Properties - Properties of the Front Door Load Balancer - *Properties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for FrontDoor. -func (fd FrontDoor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fd.Properties != nil { - objectMap["properties"] = fd.Properties - } - if fd.Location != nil { - objectMap["location"] = fd.Location - } - if fd.Tags != nil { - objectMap["tags"] = fd.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FrontDoor struct. -func (fd *FrontDoor) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var properties Properties - err = json.Unmarshal(*v, &properties) - if err != nil { - return err - } - fd.Properties = &properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fd.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - fd.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - fd.Tags = tags - } - } - } - - return nil -} - -// FrontDoorsCreateOrUpdateFutureType an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FrontDoorsCreateOrUpdateFutureType struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FrontDoorsClient) (FrontDoor, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FrontDoorsCreateOrUpdateFutureType) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FrontDoorsCreateOrUpdateFutureType.Result. -func (future *FrontDoorsCreateOrUpdateFutureType) result(client FrontDoorsClient) (fd FrontDoor, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsCreateOrUpdateFutureType", "Result", future.Response(), "Polling failure") - return - } - if !done { - fd.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.FrontDoorsCreateOrUpdateFutureType") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fd.Response.Response, err = future.GetResult(sender); err == nil && fd.Response.Response.StatusCode != http.StatusNoContent { - fd, err = client.CreateOrUpdateResponder(fd.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsCreateOrUpdateFutureType", "Result", fd.Response.Response, "Failure responding to request") - } - } - return -} - -// FrontDoorsDeleteFutureType an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FrontDoorsDeleteFutureType struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FrontDoorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FrontDoorsDeleteFutureType) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FrontDoorsDeleteFutureType.Result. -func (future *FrontDoorsDeleteFutureType) result(client FrontDoorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsDeleteFutureType", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.FrontDoorsDeleteFutureType") - return - } - ar.Response = future.Response() - return -} - -// FrontendEndpoint a frontend endpoint used for routing. -type FrontendEndpoint struct { - autorest.Response `json:"-"` - // FrontendEndpointProperties - Properties of the Frontend endpoint - *FrontendEndpointProperties `json:"properties,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for FrontendEndpoint. -func (fe FrontendEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fe.FrontendEndpointProperties != nil { - objectMap["properties"] = fe.FrontendEndpointProperties - } - if fe.Name != nil { - objectMap["name"] = fe.Name - } - if fe.ID != nil { - objectMap["id"] = fe.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FrontendEndpoint struct. -func (fe *FrontendEndpoint) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var frontendEndpointProperties FrontendEndpointProperties - err = json.Unmarshal(*v, &frontendEndpointProperties) - if err != nil { - return err - } - fe.FrontendEndpointProperties = &frontendEndpointProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fe.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fe.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fe.ID = &ID - } - } - } - - return nil -} - -// FrontendEndpointLink defines the Resource ID for a Frontend Endpoint. -type FrontendEndpointLink struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// FrontendEndpointProperties the JSON object that contains the properties required to create a frontend -// endpoint. -type FrontendEndpointProperties struct { - // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' - ResourceState ResourceState `json:"resourceState,omitempty"` - // CustomHTTPSProvisioningState - READ-ONLY; Provisioning status of Custom Https of the frontendEndpoint. Possible values include: 'CustomHTTPSProvisioningStateEnabling', 'CustomHTTPSProvisioningStateEnabled', 'CustomHTTPSProvisioningStateDisabling', 'CustomHTTPSProvisioningStateDisabled', 'CustomHTTPSProvisioningStateFailed' - CustomHTTPSProvisioningState CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"` - // CustomHTTPSProvisioningSubstate - READ-ONLY; Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. Possible values include: 'CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest', 'CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut', 'CustomHTTPSProvisioningSubstateIssuingCertificate', 'CustomHTTPSProvisioningSubstateDeployingCertificate', 'CustomHTTPSProvisioningSubstateCertificateDeployed', 'CustomHTTPSProvisioningSubstateDeletingCertificate', 'CustomHTTPSProvisioningSubstateCertificateDeleted' - CustomHTTPSProvisioningSubstate CustomHTTPSProvisioningSubstate `json:"customHttpsProvisioningSubstate,omitempty"` - // CustomHTTPSConfiguration - READ-ONLY; The configuration specifying how to enable HTTPS - CustomHTTPSConfiguration *CustomHTTPSConfiguration `json:"customHttpsConfiguration,omitempty"` - // HostName - The host name of the frontendEndpoint. Must be a domain name. - HostName *string `json:"hostName,omitempty"` - // SessionAffinityEnabledState - Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: 'SessionAffinityEnabledStateEnabled', 'SessionAffinityEnabledStateDisabled' - SessionAffinityEnabledState SessionAffinityEnabledState `json:"sessionAffinityEnabledState,omitempty"` - // SessionAffinityTTLSeconds - UNUSED. This field will be ignored. The TTL to use in seconds for session affinity, if applicable. - SessionAffinityTTLSeconds *int32 `json:"sessionAffinityTtlSeconds,omitempty"` - // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for each host (if applicable) - WebApplicationFirewallPolicyLink *FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for FrontendEndpointProperties. -func (fep FrontendEndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fep.ResourceState != "" { - objectMap["resourceState"] = fep.ResourceState - } - if fep.HostName != nil { - objectMap["hostName"] = fep.HostName - } - if fep.SessionAffinityEnabledState != "" { - objectMap["sessionAffinityEnabledState"] = fep.SessionAffinityEnabledState - } - if fep.SessionAffinityTTLSeconds != nil { - objectMap["sessionAffinityTtlSeconds"] = fep.SessionAffinityTTLSeconds - } - if fep.WebApplicationFirewallPolicyLink != nil { - objectMap["webApplicationFirewallPolicyLink"] = fep.WebApplicationFirewallPolicyLink - } - return json.Marshal(objectMap) -} - -// FrontendEndpointsDisableHTTPSFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FrontendEndpointsDisableHTTPSFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FrontendEndpointsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FrontendEndpointsDisableHTTPSFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FrontendEndpointsDisableHTTPSFuture.Result. -func (future *FrontendEndpointsDisableHTTPSFuture) result(client FrontendEndpointsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsDisableHTTPSFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.FrontendEndpointsDisableHTTPSFuture") - return - } - ar.Response = future.Response() - return -} - -// FrontendEndpointsEnableHTTPSFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FrontendEndpointsEnableHTTPSFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FrontendEndpointsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FrontendEndpointsEnableHTTPSFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FrontendEndpointsEnableHTTPSFuture.Result. -func (future *FrontendEndpointsEnableHTTPSFuture) result(client FrontendEndpointsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsEnableHTTPSFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.FrontendEndpointsEnableHTTPSFuture") - return - } - ar.Response = future.Response() - return -} - -// FrontendEndpointsListResult result of the request to list frontend endpoints. It contains a list of -// Frontend endpoint objects and a URL link to get the next set of results. -type FrontendEndpointsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Frontend endpoints within a Front Door. - Value *[]FrontendEndpoint `json:"value,omitempty"` - // NextLink - URL to get the next set of frontend endpoints if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for FrontendEndpointsListResult. -func (felr FrontendEndpointsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if felr.NextLink != nil { - objectMap["nextLink"] = felr.NextLink - } - return json.Marshal(objectMap) -} - -// FrontendEndpointsListResultIterator provides access to a complete listing of FrontendEndpoint values. -type FrontendEndpointsListResultIterator struct { - i int - page FrontendEndpointsListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *FrontendEndpointsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *FrontendEndpointsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FrontendEndpointsListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter FrontendEndpointsListResultIterator) Response() FrontendEndpointsListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter FrontendEndpointsListResultIterator) Value() FrontendEndpoint { - if !iter.page.NotDone() { - return FrontendEndpoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FrontendEndpointsListResultIterator type. -func NewFrontendEndpointsListResultIterator(page FrontendEndpointsListResultPage) FrontendEndpointsListResultIterator { - return FrontendEndpointsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (felr FrontendEndpointsListResult) IsEmpty() bool { - return felr.Value == nil || len(*felr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (felr FrontendEndpointsListResult) hasNextLink() bool { - return felr.NextLink != nil && len(*felr.NextLink) != 0 -} - -// frontendEndpointsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (felr FrontendEndpointsListResult) frontendEndpointsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !felr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(felr.NextLink))) -} - -// FrontendEndpointsListResultPage contains a page of FrontendEndpoint values. -type FrontendEndpointsListResultPage struct { - fn func(context.Context, FrontendEndpointsListResult) (FrontendEndpointsListResult, error) - felr FrontendEndpointsListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *FrontendEndpointsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.felr) - if err != nil { - return err - } - page.felr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *FrontendEndpointsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FrontendEndpointsListResultPage) NotDone() bool { - return !page.felr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FrontendEndpointsListResultPage) Response() FrontendEndpointsListResult { - return page.felr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FrontendEndpointsListResultPage) Values() []FrontendEndpoint { - if page.felr.IsEmpty() { - return nil - } - return *page.felr.Value -} - -// Creates a new instance of the FrontendEndpointsListResultPage type. -func NewFrontendEndpointsListResultPage(cur FrontendEndpointsListResult, getNextPage func(context.Context, FrontendEndpointsListResult) (FrontendEndpointsListResult, error)) FrontendEndpointsListResultPage { - return FrontendEndpointsListResultPage{ - fn: getNextPage, - felr: cur, - } -} - -// FrontendEndpointUpdateParameters frontend endpoint used in routing rule -type FrontendEndpointUpdateParameters struct { - // HostName - The host name of the frontendEndpoint. Must be a domain name. - HostName *string `json:"hostName,omitempty"` - // SessionAffinityEnabledState - Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: 'SessionAffinityEnabledStateEnabled', 'SessionAffinityEnabledStateDisabled' - SessionAffinityEnabledState SessionAffinityEnabledState `json:"sessionAffinityEnabledState,omitempty"` - // SessionAffinityTTLSeconds - UNUSED. This field will be ignored. The TTL to use in seconds for session affinity, if applicable. - SessionAffinityTTLSeconds *int32 `json:"sessionAffinityTtlSeconds,omitempty"` - // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for each host (if applicable) - WebApplicationFirewallPolicyLink *FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` -} - -// FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink defines the Web Application Firewall -// policy for each host (if applicable) -type FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// HeaderAction an action that can manipulate an http header. -type HeaderAction struct { - // HeaderActionType - Which type of manipulation to apply to the header. Possible values include: 'HeaderActionTypeAppend', 'HeaderActionTypeDelete', 'HeaderActionTypeOverwrite' - HeaderActionType HeaderActionType `json:"headerActionType,omitempty"` - // HeaderName - The name of the header this action will apply to. - HeaderName *string `json:"headerName,omitempty"` - // Value - The value to update the given header name with. This value is not used if the actionType is Delete. - Value *string `json:"value,omitempty"` -} - -// HealthProbeSettingsListResult result of the request to list HealthProbeSettings. It contains a list of -// HealthProbeSettings objects and a URL link to get the next set of results. -type HealthProbeSettingsListResult struct { - // Value - READ-ONLY; List of HealthProbeSettings within a Front Door. - Value *[]HealthProbeSettingsModel `json:"value,omitempty"` - // NextLink - URL to get the next set of HealthProbeSettings objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for HealthProbeSettingsListResult. -func (hpslr HealthProbeSettingsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hpslr.NextLink != nil { - objectMap["nextLink"] = hpslr.NextLink - } - return json.Marshal(objectMap) -} - -// HealthProbeSettingsModel load balancing settings for a backend pool -type HealthProbeSettingsModel struct { - // HealthProbeSettingsProperties - Properties of the health probe settings - *HealthProbeSettingsProperties `json:"properties,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for HealthProbeSettingsModel. -func (hpsm HealthProbeSettingsModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hpsm.HealthProbeSettingsProperties != nil { - objectMap["properties"] = hpsm.HealthProbeSettingsProperties - } - if hpsm.Name != nil { - objectMap["name"] = hpsm.Name - } - if hpsm.ID != nil { - objectMap["id"] = hpsm.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for HealthProbeSettingsModel struct. -func (hpsm *HealthProbeSettingsModel) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var healthProbeSettingsProperties HealthProbeSettingsProperties - err = json.Unmarshal(*v, &healthProbeSettingsProperties) - if err != nil { - return err - } - hpsm.HealthProbeSettingsProperties = &healthProbeSettingsProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - hpsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - hpsm.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - hpsm.ID = &ID - } - } - } - - return nil -} - -// HealthProbeSettingsProperties the JSON object that contains the properties required to create a health -// probe settings. -type HealthProbeSettingsProperties struct { - // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' - ResourceState ResourceState `json:"resourceState,omitempty"` - // Path - The path to use for the health probe. Default is / - Path *string `json:"path,omitempty"` - // Protocol - Protocol scheme to use for this probe. Possible values include: 'ProtocolHTTP', 'ProtocolHTTPS' - Protocol Protocol `json:"protocol,omitempty"` - // IntervalInSeconds - The number of seconds between health probes. - IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` - // HealthProbeMethod - Configures which HTTP method to use to probe the backends defined under backendPools. Possible values include: 'HealthProbeMethodGET', 'HealthProbeMethodHEAD' - HealthProbeMethod HealthProbeMethod `json:"healthProbeMethod,omitempty"` - // EnabledState - Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: 'HealthProbeEnabledEnabled', 'HealthProbeEnabledDisabled' - EnabledState HealthProbeEnabled `json:"enabledState,omitempty"` -} - -// HealthProbeSettingsUpdateParameters l7 health probe settings for a backend pool -type HealthProbeSettingsUpdateParameters struct { - // Path - The path to use for the health probe. Default is / - Path *string `json:"path,omitempty"` - // Protocol - Protocol scheme to use for this probe. Possible values include: 'ProtocolHTTP', 'ProtocolHTTPS' - Protocol Protocol `json:"protocol,omitempty"` - // IntervalInSeconds - The number of seconds between health probes. - IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` - // HealthProbeMethod - Configures which HTTP method to use to probe the backends defined under backendPools. Possible values include: 'HealthProbeMethodGET', 'HealthProbeMethodHEAD' - HealthProbeMethod HealthProbeMethod `json:"healthProbeMethod,omitempty"` - // EnabledState - Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: 'HealthProbeEnabledEnabled', 'HealthProbeEnabledDisabled' - EnabledState HealthProbeEnabled `json:"enabledState,omitempty"` -} - -// KeyVaultCertificateSourceParameters parameters required for bring-your-own-certification via Key Vault -type KeyVaultCertificateSourceParameters struct { - // Vault - The Key Vault containing the SSL certificate - Vault *KeyVaultCertificateSourceParametersVault `json:"vault,omitempty"` - // SecretName - The name of the Key Vault secret representing the full certificate PFX - SecretName *string `json:"secretName,omitempty"` - // SecretVersion - The version of the Key Vault secret representing the full certificate PFX - SecretVersion *string `json:"secretVersion,omitempty"` -} - -// KeyVaultCertificateSourceParametersVault the Key Vault containing the SSL certificate -type KeyVaultCertificateSourceParametersVault struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// LatencyMetric defines the properties of a latency metric used in the latency scorecard -type LatencyMetric struct { - // Name - READ-ONLY; The name of the Latency Metric - Name *string `json:"name,omitempty"` - // EndDateTimeUTC - READ-ONLY; The end time of the Latency Scorecard in UTC - EndDateTimeUTC *string `json:"endDateTimeUTC,omitempty"` - // AValue - READ-ONLY; The metric value of the A endpoint - AValue *float64 `json:"aValue,omitempty"` - // BValue - READ-ONLY; The metric value of the B endpoint - BValue *float64 `json:"bValue,omitempty"` - // Delta - READ-ONLY; The difference in value between endpoint A and B - Delta *float64 `json:"delta,omitempty"` - // DeltaPercent - READ-ONLY; The percent difference between endpoint A and B - DeltaPercent *float64 `json:"deltaPercent,omitempty"` - // ACLower95CI - READ-ONLY; The lower end of the 95% confidence interval for endpoint A - ACLower95CI *float64 `json:"aCLower95CI,omitempty"` - // AHUpper95CI - READ-ONLY; The upper end of the 95% confidence interval for endpoint A - AHUpper95CI *float64 `json:"aHUpper95CI,omitempty"` - // BCLower95CI - READ-ONLY; The lower end of the 95% confidence interval for endpoint B - BCLower95CI *float64 `json:"bCLower95CI,omitempty"` - // BUpper95CI - READ-ONLY; The upper end of the 95% confidence interval for endpoint B - BUpper95CI *float64 `json:"bUpper95CI,omitempty"` -} - -// MarshalJSON is the custom marshaler for LatencyMetric. -func (lm LatencyMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LatencyScorecard defines the LatencyScorecard -type LatencyScorecard struct { - autorest.Response `json:"-"` - // LatencyScorecardProperties - The properties of a latency scorecard - *LatencyScorecardProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for LatencyScorecard. -func (ls LatencyScorecard) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ls.LatencyScorecardProperties != nil { - objectMap["properties"] = ls.LatencyScorecardProperties - } - if ls.Location != nil { - objectMap["location"] = ls.Location - } - if ls.Tags != nil { - objectMap["tags"] = ls.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LatencyScorecard struct. -func (ls *LatencyScorecard) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var latencyScorecardProperties LatencyScorecardProperties - err = json.Unmarshal(*v, &latencyScorecardProperties) - if err != nil { - return err - } - ls.LatencyScorecardProperties = &latencyScorecardProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ls.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ls.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ls.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ls.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ls.Tags = tags - } - } - } - - return nil -} - -// LatencyScorecardProperties defines a the properties of a Latency Scorecard -type LatencyScorecardProperties struct { - // ID - READ-ONLY; The unique identifier of the Latency Scorecard - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the Latency Scorecard - Name *string `json:"name,omitempty"` - // Description - READ-ONLY; The description of the Latency Scorecard - Description *string `json:"description,omitempty"` - // EndpointA - READ-ONLY; The A endpoint in the scorecard - EndpointA *string `json:"endpointA,omitempty"` - // EndpointB - READ-ONLY; The B endpoint in the scorecard - EndpointB *string `json:"endpointB,omitempty"` - // StartDateTimeUTC - READ-ONLY; The start time of the Latency Scorecard in UTC - StartDateTimeUTC *date.Time `json:"startDateTimeUTC,omitempty"` - // EndDateTimeUTC - READ-ONLY; The end time of the Latency Scorecard in UTC - EndDateTimeUTC *date.Time `json:"endDateTimeUTC,omitempty"` - // Country - READ-ONLY; The country associated with the Latency Scorecard. Values are country ISO codes as specified here- https://www.iso.org/iso-3166-country-codes.html - Country *string `json:"country,omitempty"` - // LatencyMetrics - The latency metrics of the Latency Scorecard - LatencyMetrics *[]LatencyMetric `json:"latencyMetrics,omitempty"` -} - -// MarshalJSON is the custom marshaler for LatencyScorecardProperties. -func (lsp LatencyScorecardProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsp.LatencyMetrics != nil { - objectMap["latencyMetrics"] = lsp.LatencyMetrics - } - return json.Marshal(objectMap) -} - -// ListResult result of the request to list Front Doors. It contains a list of Front Door objects and a URL -// link to get the next set of results. -type ListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Front Doors within a resource group. - Value *[]FrontDoor `json:"value,omitempty"` - // NextLink - URL to get the next set of Front Door objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListResult. -func (lr ListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lr.NextLink != nil { - objectMap["nextLink"] = lr.NextLink - } - return json.Marshal(objectMap) -} - -// ListResultIterator provides access to a complete listing of FrontDoor values. -type ListResultIterator struct { - i int - page ListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListResultIterator) Response() ListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListResultIterator) Value() FrontDoor { - if !iter.page.NotDone() { - return FrontDoor{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListResultIterator type. -func NewListResultIterator(page ListResultPage) ListResultIterator { - return ListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lr ListResult) IsEmpty() bool { - return lr.Value == nil || len(*lr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lr ListResult) hasNextLink() bool { - return lr.NextLink != nil && len(*lr.NextLink) != 0 -} - -// listResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { - if !lr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lr.NextLink))) -} - -// ListResultPage contains a page of FrontDoor values. -type ListResultPage struct { - fn func(context.Context, ListResult) (ListResult, error) - lr ListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lr) - if err != nil { - return err - } - page.lr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListResultPage) NotDone() bool { - return !page.lr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListResultPage) Response() ListResult { - return page.lr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListResultPage) Values() []FrontDoor { - if page.lr.IsEmpty() { - return nil - } - return *page.lr.Value -} - -// Creates a new instance of the ListResultPage type. -func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { - return ListResultPage{ - fn: getNextPage, - lr: cur, - } -} - -// LoadBalancingSettingsListResult result of the request to list load balancing settings. It contains a -// list of load balancing settings objects and a URL link to get the next set of results. -type LoadBalancingSettingsListResult struct { - // Value - READ-ONLY; List of Backend Pools within a Front Door. - Value *[]LoadBalancingSettingsModel `json:"value,omitempty"` - // NextLink - URL to get the next set of LoadBalancingSettings objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancingSettingsListResult. -func (lbslr LoadBalancingSettingsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbslr.NextLink != nil { - objectMap["nextLink"] = lbslr.NextLink - } - return json.Marshal(objectMap) -} - -// LoadBalancingSettingsModel load balancing settings for a backend pool -type LoadBalancingSettingsModel struct { - // LoadBalancingSettingsProperties - Properties of the load balancing settings - *LoadBalancingSettingsProperties `json:"properties,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancingSettingsModel. -func (lbsm LoadBalancingSettingsModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbsm.LoadBalancingSettingsProperties != nil { - objectMap["properties"] = lbsm.LoadBalancingSettingsProperties - } - if lbsm.Name != nil { - objectMap["name"] = lbsm.Name - } - if lbsm.ID != nil { - objectMap["id"] = lbsm.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoadBalancingSettingsModel struct. -func (lbsm *LoadBalancingSettingsModel) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var loadBalancingSettingsProperties LoadBalancingSettingsProperties - err = json.Unmarshal(*v, &loadBalancingSettingsProperties) - if err != nil { - return err - } - lbsm.LoadBalancingSettingsProperties = &loadBalancingSettingsProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lbsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lbsm.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lbsm.ID = &ID - } - } - } - - return nil -} - -// LoadBalancingSettingsProperties the JSON object that contains the properties required to create load -// balancing settings -type LoadBalancingSettingsProperties struct { - // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' - ResourceState ResourceState `json:"resourceState,omitempty"` - // SampleSize - The number of samples to consider for load balancing decisions - SampleSize *int32 `json:"sampleSize,omitempty"` - // SuccessfulSamplesRequired - The number of samples within the sample period that must succeed - SuccessfulSamplesRequired *int32 `json:"successfulSamplesRequired,omitempty"` - // AdditionalLatencyMilliseconds - The additional latency in milliseconds for probes to fall into the lowest latency bucket - AdditionalLatencyMilliseconds *int32 `json:"additionalLatencyMilliseconds,omitempty"` -} - -// LoadBalancingSettingsUpdateParameters round-Robin load balancing settings for a backend pool -type LoadBalancingSettingsUpdateParameters struct { - // SampleSize - The number of samples to consider for load balancing decisions - SampleSize *int32 `json:"sampleSize,omitempty"` - // SuccessfulSamplesRequired - The number of samples within the sample period that must succeed - SuccessfulSamplesRequired *int32 `json:"successfulSamplesRequired,omitempty"` - // AdditionalLatencyMilliseconds - The additional latency in milliseconds for probes to fall into the lowest latency bucket - AdditionalLatencyMilliseconds *int32 `json:"additionalLatencyMilliseconds,omitempty"` -} - -// ManagedRuleDefinition describes a managed rule definition. -type ManagedRuleDefinition struct { - // RuleID - READ-ONLY; Identifier for the managed rule. - RuleID *string `json:"ruleId,omitempty"` - // DefaultState - READ-ONLY; Describes the default state for the managed rule. Possible values include: 'ManagedRuleEnabledStateDisabled', 'ManagedRuleEnabledStateEnabled' - DefaultState ManagedRuleEnabledState `json:"defaultState,omitempty"` - // DefaultAction - READ-ONLY; Describes the default action to be applied when the managed rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' - DefaultAction ActionType `json:"defaultAction,omitempty"` - // Description - READ-ONLY; Describes the functionality of the managed rule. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedRuleDefinition. -func (mrd ManagedRuleDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedRuleExclusion exclude variables from managed rule evaluation. -type ManagedRuleExclusion struct { - // MatchVariable - The variable type to be excluded. Possible values include: 'ManagedRuleExclusionMatchVariableRequestHeaderNames', 'ManagedRuleExclusionMatchVariableRequestCookieNames', 'ManagedRuleExclusionMatchVariableQueryStringArgNames', 'ManagedRuleExclusionMatchVariableRequestBodyPostArgNames', 'ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames' - MatchVariable ManagedRuleExclusionMatchVariable `json:"matchVariable,omitempty"` - // SelectorMatchOperator - Comparison operator to apply to the selector when specifying which elements in the collection this exclusion applies to. Possible values include: 'ManagedRuleExclusionSelectorMatchOperatorEquals', 'ManagedRuleExclusionSelectorMatchOperatorContains', 'ManagedRuleExclusionSelectorMatchOperatorStartsWith', 'ManagedRuleExclusionSelectorMatchOperatorEndsWith', 'ManagedRuleExclusionSelectorMatchOperatorEqualsAny' - SelectorMatchOperator ManagedRuleExclusionSelectorMatchOperator `json:"selectorMatchOperator,omitempty"` - // Selector - Selector value for which elements in the collection this exclusion applies to. - Selector *string `json:"selector,omitempty"` -} - -// ManagedRuleGroupDefinition describes a managed rule group. -type ManagedRuleGroupDefinition struct { - // RuleGroupName - READ-ONLY; Name of the managed rule group. - RuleGroupName *string `json:"ruleGroupName,omitempty"` - // Description - READ-ONLY; Description of the managed rule group. - Description *string `json:"description,omitempty"` - // Rules - READ-ONLY; List of rules within the managed rule group. - Rules *[]ManagedRuleDefinition `json:"rules,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedRuleGroupDefinition. -func (mrgd ManagedRuleGroupDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedRuleGroupOverride defines a managed rule group override setting. -type ManagedRuleGroupOverride struct { - // RuleGroupName - Describes the managed rule group to override. - RuleGroupName *string `json:"ruleGroupName,omitempty"` - // Exclusions - Describes the exclusions that are applied to all rules in the group. - Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` - // Rules - List of rules that will be disabled. If none specified, all rules in the group will be disabled. - Rules *[]ManagedRuleOverride `json:"rules,omitempty"` -} - -// ManagedRuleOverride defines a managed rule group override setting. -type ManagedRuleOverride struct { - // RuleID - Identifier for the managed rule. - RuleID *string `json:"ruleId,omitempty"` - // EnabledState - Describes if the managed rule is in enabled or disabled state. Defaults to Disabled if not specified. Possible values include: 'ManagedRuleEnabledStateDisabled', 'ManagedRuleEnabledStateEnabled' - EnabledState ManagedRuleEnabledState `json:"enabledState,omitempty"` - // Action - Describes the override action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' - Action ActionType `json:"action,omitempty"` - // Exclusions - Describes the exclusions that are applied to this specific rule. - Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` -} - -// ManagedRuleSet defines a managed rule set. -type ManagedRuleSet struct { - // RuleSetType - Defines the rule set type to use. - RuleSetType *string `json:"ruleSetType,omitempty"` - // RuleSetVersion - Defines the version of the rule set to use. - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` - // RuleSetAction - Possible values include: 'ManagedRuleSetActionTypeBlock', 'ManagedRuleSetActionTypeLog', 'ManagedRuleSetActionTypeRedirect' - RuleSetAction ManagedRuleSetActionType `json:"ruleSetAction,omitempty"` - // Exclusions - Describes the exclusions that are applied to all rules in the set. - Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` - // RuleGroupOverrides - Defines the rule group overrides to apply to the rule set. - RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` -} - -// ManagedRuleSetDefinition describes the a managed rule set definition. -type ManagedRuleSetDefinition struct { - // ManagedRuleSetDefinitionProperties - Properties for a managed rule set definition. - *ManagedRuleSetDefinitionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedRuleSetDefinition. -func (mrsd ManagedRuleSetDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mrsd.ManagedRuleSetDefinitionProperties != nil { - objectMap["properties"] = mrsd.ManagedRuleSetDefinitionProperties - } - if mrsd.Location != nil { - objectMap["location"] = mrsd.Location - } - if mrsd.Tags != nil { - objectMap["tags"] = mrsd.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedRuleSetDefinition struct. -func (mrsd *ManagedRuleSetDefinition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managedRuleSetDefinitionProperties ManagedRuleSetDefinitionProperties - err = json.Unmarshal(*v, &managedRuleSetDefinitionProperties) - if err != nil { - return err - } - mrsd.ManagedRuleSetDefinitionProperties = &managedRuleSetDefinitionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mrsd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mrsd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mrsd.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mrsd.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mrsd.Tags = tags - } - } - } - - return nil -} - -// ManagedRuleSetDefinitionList list of managed rule set definitions available for use in a policy. -type ManagedRuleSetDefinitionList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of managed rule set definitions. - Value *[]ManagedRuleSetDefinition `json:"value,omitempty"` - // NextLink - URL to retrieve next set of managed rule set definitions. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedRuleSetDefinitionList. -func (mrsdl ManagedRuleSetDefinitionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mrsdl.NextLink != nil { - objectMap["nextLink"] = mrsdl.NextLink - } - return json.Marshal(objectMap) -} - -// ManagedRuleSetDefinitionListIterator provides access to a complete listing of ManagedRuleSetDefinition -// values. -type ManagedRuleSetDefinitionListIterator struct { - i int - page ManagedRuleSetDefinitionListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ManagedRuleSetDefinitionListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetDefinitionListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ManagedRuleSetDefinitionListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedRuleSetDefinitionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ManagedRuleSetDefinitionListIterator) Response() ManagedRuleSetDefinitionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ManagedRuleSetDefinitionListIterator) Value() ManagedRuleSetDefinition { - if !iter.page.NotDone() { - return ManagedRuleSetDefinition{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedRuleSetDefinitionListIterator type. -func NewManagedRuleSetDefinitionListIterator(page ManagedRuleSetDefinitionListPage) ManagedRuleSetDefinitionListIterator { - return ManagedRuleSetDefinitionListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mrsdl ManagedRuleSetDefinitionList) IsEmpty() bool { - return mrsdl.Value == nil || len(*mrsdl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mrsdl ManagedRuleSetDefinitionList) hasNextLink() bool { - return mrsdl.NextLink != nil && len(*mrsdl.NextLink) != 0 -} - -// managedRuleSetDefinitionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mrsdl ManagedRuleSetDefinitionList) managedRuleSetDefinitionListPreparer(ctx context.Context) (*http.Request, error) { - if !mrsdl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mrsdl.NextLink))) -} - -// ManagedRuleSetDefinitionListPage contains a page of ManagedRuleSetDefinition values. -type ManagedRuleSetDefinitionListPage struct { - fn func(context.Context, ManagedRuleSetDefinitionList) (ManagedRuleSetDefinitionList, error) - mrsdl ManagedRuleSetDefinitionList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ManagedRuleSetDefinitionListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetDefinitionListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mrsdl) - if err != nil { - return err - } - page.mrsdl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ManagedRuleSetDefinitionListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedRuleSetDefinitionListPage) NotDone() bool { - return !page.mrsdl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedRuleSetDefinitionListPage) Response() ManagedRuleSetDefinitionList { - return page.mrsdl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedRuleSetDefinitionListPage) Values() []ManagedRuleSetDefinition { - if page.mrsdl.IsEmpty() { - return nil - } - return *page.mrsdl.Value -} - -// Creates a new instance of the ManagedRuleSetDefinitionListPage type. -func NewManagedRuleSetDefinitionListPage(cur ManagedRuleSetDefinitionList, getNextPage func(context.Context, ManagedRuleSetDefinitionList) (ManagedRuleSetDefinitionList, error)) ManagedRuleSetDefinitionListPage { - return ManagedRuleSetDefinitionListPage{ - fn: getNextPage, - mrsdl: cur, - } -} - -// ManagedRuleSetDefinitionProperties properties for a managed rule set definition. -type ManagedRuleSetDefinitionProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the managed rule set. - ProvisioningState *string `json:"provisioningState,omitempty"` - // RuleSetID - READ-ONLY; Id of the managed rule set. - RuleSetID *string `json:"ruleSetId,omitempty"` - // RuleSetType - READ-ONLY; Type of the managed rule set. - RuleSetType *string `json:"ruleSetType,omitempty"` - // RuleSetVersion - READ-ONLY; Version of the managed rule set type. - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` - // RuleGroups - READ-ONLY; Rule groups of the managed rule set. - RuleGroups *[]ManagedRuleGroupDefinition `json:"ruleGroups,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedRuleSetDefinitionProperties. -func (mrsdp ManagedRuleSetDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedRuleSetList defines the list of managed rule sets for the policy. -type ManagedRuleSetList struct { - // ManagedRuleSets - List of rule sets. - ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` -} - -// MatchCondition define a match condition. -type MatchCondition struct { - // MatchVariable - Request variable to compare with. Possible values include: 'MatchVariableRemoteAddr', 'MatchVariableRequestMethod', 'MatchVariableQueryString', 'MatchVariablePostArgs', 'MatchVariableRequestURI', 'MatchVariableRequestHeader', 'MatchVariableRequestBody', 'MatchVariableCookies', 'MatchVariableSocketAddr' - MatchVariable MatchVariable `json:"matchVariable,omitempty"` - // Selector - Match against a specific key from the QueryString, PostArgs, RequestHeader or Cookies variables. Default is null. - Selector *string `json:"selector,omitempty"` - // Operator - Comparison type to use for matching with the variable value. Possible values include: 'OperatorAny', 'OperatorIPMatch', 'OperatorGeoMatch', 'OperatorEqual', 'OperatorContains', 'OperatorLessThan', 'OperatorGreaterThan', 'OperatorLessThanOrEqual', 'OperatorGreaterThanOrEqual', 'OperatorBeginsWith', 'OperatorEndsWith', 'OperatorRegEx' - Operator Operator `json:"operator,omitempty"` - // NegateCondition - Describes if the result of this condition should be negated. - NegateCondition *bool `json:"negateCondition,omitempty"` - // MatchValue - List of possible match values. - MatchValue *[]string `json:"matchValue,omitempty"` - // Transforms - List of transforms. - Transforms *[]TransformType `json:"transforms,omitempty"` -} - -// NetworkExperimentProfilesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type NetworkExperimentProfilesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NetworkExperimentProfilesClient) (Profile, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NetworkExperimentProfilesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NetworkExperimentProfilesCreateOrUpdateFuture.Result. -func (future *NetworkExperimentProfilesCreateOrUpdateFuture) result(client NetworkExperimentProfilesClient) (p Profile, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - p.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.NetworkExperimentProfilesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { - p, err = client.CreateOrUpdateResponder(p.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesCreateOrUpdateFuture", "Result", p.Response.Response, "Failure responding to request") - } - } - return -} - -// NetworkExperimentProfilesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NetworkExperimentProfilesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NetworkExperimentProfilesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NetworkExperimentProfilesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NetworkExperimentProfilesDeleteFuture.Result. -func (future *NetworkExperimentProfilesDeleteFuture) result(client NetworkExperimentProfilesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.NetworkExperimentProfilesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NetworkExperimentProfilesUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NetworkExperimentProfilesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NetworkExperimentProfilesClient) (Profile, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NetworkExperimentProfilesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NetworkExperimentProfilesUpdateFuture.Result. -func (future *NetworkExperimentProfilesUpdateFuture) result(client NetworkExperimentProfilesClient) (p Profile, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - p.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.NetworkExperimentProfilesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { - p, err = client.UpdateResponder(p.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesUpdateFuture", "Result", p.Response.Response, "Failure responding to request") - } - } - return -} - -// PoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoliciesClient) (WebApplicationFirewallPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoliciesCreateOrUpdateFuture.Result. -func (future *PoliciesCreateOrUpdateFuture) result(client PoliciesClient) (wafp WebApplicationFirewallPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - wafp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.PoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if wafp.Response.Response, err = future.GetResult(sender); err == nil && wafp.Response.Response.StatusCode != http.StatusNoContent { - wafp, err = client.CreateOrUpdateResponder(wafp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesCreateOrUpdateFuture", "Result", wafp.Response.Response, "Failure responding to request") - } - } - return -} - -// PoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PoliciesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoliciesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoliciesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoliciesDeleteFuture.Result. -func (future *PoliciesDeleteFuture) result(client PoliciesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.PoliciesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PolicySettings defines top-level WebApplicationFirewallPolicy configuration settings. -type PolicySettings struct { - // EnabledState - Describes if the policy is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: 'PolicyEnabledStateDisabled', 'PolicyEnabledStateEnabled' - EnabledState PolicyEnabledState `json:"enabledState,omitempty"` - // Mode - Describes if it is in detection mode or prevention mode at policy level. Possible values include: 'PolicyModePrevention', 'PolicyModeDetection' - Mode PolicyMode `json:"mode,omitempty"` - // RedirectURL - If action type is redirect, this field represents redirect URL for the client. - RedirectURL *string `json:"redirectUrl,omitempty"` - // CustomBlockResponseStatusCode - If the action type is block, customer can override the response status code. - CustomBlockResponseStatusCode *int32 `json:"customBlockResponseStatusCode,omitempty"` - // CustomBlockResponseBody - If the action type is block, customer can override the response body. The body must be specified in base64 encoding. - CustomBlockResponseBody *string `json:"customBlockResponseBody,omitempty"` - // RequestBodyCheck - Describes if policy managed rules will inspect the request body content. Possible values include: 'PolicyRequestBodyCheckDisabled', 'PolicyRequestBodyCheckEnabled' - RequestBodyCheck PolicyRequestBodyCheck `json:"requestBodyCheck,omitempty"` -} - -// PreconfiguredEndpoint defines the properties of a preconfigured endpoint -type PreconfiguredEndpoint struct { - // PreconfiguredEndpointProperties - The properties of a preconfiguredEndpoint - *PreconfiguredEndpointProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PreconfiguredEndpoint. -func (peVar PreconfiguredEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if peVar.PreconfiguredEndpointProperties != nil { - objectMap["properties"] = peVar.PreconfiguredEndpointProperties - } - if peVar.Location != nil { - objectMap["location"] = peVar.Location - } - if peVar.Tags != nil { - objectMap["tags"] = peVar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PreconfiguredEndpoint struct. -func (peVar *PreconfiguredEndpoint) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var preconfiguredEndpointProperties PreconfiguredEndpointProperties - err = json.Unmarshal(*v, &preconfiguredEndpointProperties) - if err != nil { - return err - } - peVar.PreconfiguredEndpointProperties = &preconfiguredEndpointProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - peVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - peVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - peVar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - peVar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - peVar.Tags = tags - } - } - } - - return nil -} - -// PreconfiguredEndpointList defines a list of preconfigured endpoints. -type PreconfiguredEndpointList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of PreconfiguredEndpoints supported by NetworkExperiment. - Value *[]PreconfiguredEndpoint `json:"value,omitempty"` - // NextLink - URL to get the next set of PreconfiguredEndpoints if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PreconfiguredEndpointList. -func (pel PreconfiguredEndpointList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pel.NextLink != nil { - objectMap["nextLink"] = pel.NextLink - } - return json.Marshal(objectMap) -} - -// PreconfiguredEndpointListIterator provides access to a complete listing of PreconfiguredEndpoint values. -type PreconfiguredEndpointListIterator struct { - i int - page PreconfiguredEndpointListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PreconfiguredEndpointListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PreconfiguredEndpointListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PreconfiguredEndpointListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PreconfiguredEndpointListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PreconfiguredEndpointListIterator) Response() PreconfiguredEndpointList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PreconfiguredEndpointListIterator) Value() PreconfiguredEndpoint { - if !iter.page.NotDone() { - return PreconfiguredEndpoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PreconfiguredEndpointListIterator type. -func NewPreconfiguredEndpointListIterator(page PreconfiguredEndpointListPage) PreconfiguredEndpointListIterator { - return PreconfiguredEndpointListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pel PreconfiguredEndpointList) IsEmpty() bool { - return pel.Value == nil || len(*pel.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pel PreconfiguredEndpointList) hasNextLink() bool { - return pel.NextLink != nil && len(*pel.NextLink) != 0 -} - -// preconfiguredEndpointListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pel PreconfiguredEndpointList) preconfiguredEndpointListPreparer(ctx context.Context) (*http.Request, error) { - if !pel.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pel.NextLink))) -} - -// PreconfiguredEndpointListPage contains a page of PreconfiguredEndpoint values. -type PreconfiguredEndpointListPage struct { - fn func(context.Context, PreconfiguredEndpointList) (PreconfiguredEndpointList, error) - pel PreconfiguredEndpointList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PreconfiguredEndpointListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PreconfiguredEndpointListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pel) - if err != nil { - return err - } - page.pel = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PreconfiguredEndpointListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PreconfiguredEndpointListPage) NotDone() bool { - return !page.pel.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PreconfiguredEndpointListPage) Response() PreconfiguredEndpointList { - return page.pel -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PreconfiguredEndpointListPage) Values() []PreconfiguredEndpoint { - if page.pel.IsEmpty() { - return nil - } - return *page.pel.Value -} - -// Creates a new instance of the PreconfiguredEndpointListPage type. -func NewPreconfiguredEndpointListPage(cur PreconfiguredEndpointList, getNextPage func(context.Context, PreconfiguredEndpointList) (PreconfiguredEndpointList, error)) PreconfiguredEndpointListPage { - return PreconfiguredEndpointListPage{ - fn: getNextPage, - pel: cur, - } -} - -// PreconfiguredEndpointProperties defines the properties of a preconfigured endpoint -type PreconfiguredEndpointProperties struct { - // Description - The description of the endpoint - Description *string `json:"description,omitempty"` - // Endpoint - The endpoint that is preconfigured - Endpoint *string `json:"endpoint,omitempty"` - // EndpointType - The type of endpoint. Possible values include: 'EndpointTypeAFD', 'EndpointTypeAzureRegion', 'EndpointTypeCDN', 'EndpointTypeATM' - EndpointType EndpointType `json:"endpointType,omitempty"` - // Backend - The preconfigured endpoint backend - Backend *string `json:"backend,omitempty"` -} - -// Profile defines an Network Experiment Profile and lists of Experiments -type Profile struct { - autorest.Response `json:"-"` - // ProfileProperties - The properties of a Profile - *ProfileProperties `json:"properties,omitempty"` - // Etag - Gets a unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Profile. -func (p Profile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.ProfileProperties != nil { - objectMap["properties"] = p.ProfileProperties - } - if p.Etag != nil { - objectMap["etag"] = p.Etag - } - if p.Location != nil { - objectMap["location"] = p.Location - } - if p.Tags != nil { - objectMap["tags"] = p.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Profile struct. -func (p *Profile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var profileProperties ProfileProperties - err = json.Unmarshal(*v, &profileProperties) - if err != nil { - return err - } - p.ProfileProperties = &profileProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - p.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - p.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - p.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - p.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - p.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - p.Tags = tags - } - } - } - - return nil -} - -// ProfileList defines a list of Profiles. It contains a list of Profile objects and a URL link to get the -// next set of results. -type ProfileList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Profiles within a resource group. - Value *[]Profile `json:"value,omitempty"` - // NextLink - URL to get the next set of Profile objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProfileList. -func (pl ProfileList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pl.NextLink != nil { - objectMap["nextLink"] = pl.NextLink - } - return json.Marshal(objectMap) -} - -// ProfileListIterator provides access to a complete listing of Profile values. -type ProfileListIterator struct { - i int - page ProfileListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ProfileListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ProfileListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProfileListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ProfileListIterator) Response() ProfileList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ProfileListIterator) Value() Profile { - if !iter.page.NotDone() { - return Profile{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProfileListIterator type. -func NewProfileListIterator(page ProfileListPage) ProfileListIterator { - return ProfileListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pl ProfileList) IsEmpty() bool { - return pl.Value == nil || len(*pl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pl ProfileList) hasNextLink() bool { - return pl.NextLink != nil && len(*pl.NextLink) != 0 -} - -// profileListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pl ProfileList) profileListPreparer(ctx context.Context) (*http.Request, error) { - if !pl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pl.NextLink))) -} - -// ProfileListPage contains a page of Profile values. -type ProfileListPage struct { - fn func(context.Context, ProfileList) (ProfileList, error) - pl ProfileList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ProfileListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pl) - if err != nil { - return err - } - page.pl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ProfileListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProfileListPage) NotDone() bool { - return !page.pl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProfileListPage) Response() ProfileList { - return page.pl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProfileListPage) Values() []Profile { - if page.pl.IsEmpty() { - return nil - } - return *page.pl.Value -} - -// Creates a new instance of the ProfileListPage type. -func NewProfileListPage(cur ProfileList, getNextPage func(context.Context, ProfileList) (ProfileList, error)) ProfileListPage { - return ProfileListPage{ - fn: getNextPage, - pl: cur, - } -} - -// ProfileProperties defines the properties of an experiment -type ProfileProperties struct { - // ResourceState - Resource status. Possible values include: 'NetworkExperimentResourceStateCreating', 'NetworkExperimentResourceStateEnabling', 'NetworkExperimentResourceStateEnabled', 'NetworkExperimentResourceStateDisabling', 'NetworkExperimentResourceStateDisabled', 'NetworkExperimentResourceStateDeleting' - ResourceState NetworkExperimentResourceState `json:"resourceState,omitempty"` - // EnabledState - The state of the Experiment. Possible values include: 'StateEnabled', 'StateDisabled' - EnabledState State `json:"enabledState,omitempty"` -} - -// ProfileUpdateModel defines modifiable attributes of a Profile -type ProfileUpdateModel struct { - // ProfileUpdateProperties - The properties of a Profile - *ProfileUpdateProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ProfileUpdateModel. -func (pum ProfileUpdateModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pum.ProfileUpdateProperties != nil { - objectMap["properties"] = pum.ProfileUpdateProperties - } - if pum.Tags != nil { - objectMap["tags"] = pum.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProfileUpdateModel struct. -func (pum *ProfileUpdateModel) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var profileUpdateProperties ProfileUpdateProperties - err = json.Unmarshal(*v, &profileUpdateProperties) - if err != nil { - return err - } - pum.ProfileUpdateProperties = &profileUpdateProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pum.Tags = tags - } - } - } - - return nil -} - -// ProfileUpdateProperties defines the properties of an experiment -type ProfileUpdateProperties struct { - // EnabledState - The enabled state of the Profile. Possible values include: 'StateEnabled', 'StateDisabled' - EnabledState State `json:"enabledState,omitempty"` -} - -// Properties the JSON object that contains the properties required to create an endpoint. -type Properties struct { - // ResourceState - Resource status of the Front Door. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' - ResourceState ResourceState `json:"resourceState,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the Front Door. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Cname - READ-ONLY; The host that each frontendEndpoint must CNAME to. - Cname *string `json:"cname,omitempty"` - // FrontdoorID - READ-ONLY; The Id of the frontdoor. - FrontdoorID *string `json:"frontdoorId,omitempty"` - // RulesEngines - READ-ONLY; Rules Engine Configurations available to routing rules. - RulesEngines *[]RulesEngine `json:"rulesEngines,omitempty"` - // FriendlyName - A friendly name for the frontDoor - FriendlyName *string `json:"friendlyName,omitempty"` - // RoutingRules - Routing rules associated with this Front Door. - RoutingRules *[]RoutingRule `json:"routingRules,omitempty"` - // LoadBalancingSettings - Load balancing settings associated with this Front Door instance. - LoadBalancingSettings *[]LoadBalancingSettingsModel `json:"loadBalancingSettings,omitempty"` - // HealthProbeSettings - Health probe settings associated with this Front Door instance. - HealthProbeSettings *[]HealthProbeSettingsModel `json:"healthProbeSettings,omitempty"` - // BackendPools - Backend pools available to routing rules. - BackendPools *[]BackendPool `json:"backendPools,omitempty"` - // FrontendEndpoints - Frontend endpoints available to routing rules. - FrontendEndpoints *[]FrontendEndpoint `json:"frontendEndpoints,omitempty"` - // BackendPoolsSettings - Settings for all backendPools - BackendPoolsSettings *BackendPoolsSettings `json:"backendPoolsSettings,omitempty"` - // EnabledState - Operational status of the Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' - EnabledState EnabledState `json:"enabledState,omitempty"` -} - -// MarshalJSON is the custom marshaler for Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.ResourceState != "" { - objectMap["resourceState"] = p.ResourceState - } - if p.FriendlyName != nil { - objectMap["friendlyName"] = p.FriendlyName - } - if p.RoutingRules != nil { - objectMap["routingRules"] = p.RoutingRules - } - if p.LoadBalancingSettings != nil { - objectMap["loadBalancingSettings"] = p.LoadBalancingSettings - } - if p.HealthProbeSettings != nil { - objectMap["healthProbeSettings"] = p.HealthProbeSettings - } - if p.BackendPools != nil { - objectMap["backendPools"] = p.BackendPools - } - if p.FrontendEndpoints != nil { - objectMap["frontendEndpoints"] = p.FrontendEndpoints - } - if p.BackendPoolsSettings != nil { - objectMap["backendPoolsSettings"] = p.BackendPoolsSettings - } - if p.EnabledState != "" { - objectMap["enabledState"] = p.EnabledState - } - return json.Marshal(objectMap) -} - -// PurgeParameters parameters required for content purge. -type PurgeParameters struct { - // ContentPaths - The path to the content to be purged. Can describe a file path or a wild card directory. - ContentPaths *[]string `json:"contentPaths,omitempty"` -} - -// RedirectConfiguration describes Redirect Route. -type RedirectConfiguration struct { - // RedirectType - The redirect type the rule will use when redirecting traffic. Possible values include: 'RedirectTypeMoved', 'RedirectTypeFound', 'RedirectTypeTemporaryRedirect', 'RedirectTypePermanentRedirect' - RedirectType RedirectType `json:"redirectType,omitempty"` - // RedirectProtocol - The protocol of the destination to where the traffic is redirected. Possible values include: 'RedirectProtocolHTTPOnly', 'RedirectProtocolHTTPSOnly', 'RedirectProtocolMatchRequest' - RedirectProtocol RedirectProtocol `json:"redirectProtocol,omitempty"` - // CustomHost - Host to redirect. Leave empty to use the incoming host as the destination host. - CustomHost *string `json:"customHost,omitempty"` - // CustomPath - The full path to redirect. Path cannot be empty and must start with /. Leave empty to use the incoming path as destination path. - CustomPath *string `json:"customPath,omitempty"` - // CustomFragment - Fragment to add to the redirect URL. Fragment is the part of the URL that comes after #. Do not include the #. - CustomFragment *string `json:"customFragment,omitempty"` - // CustomQueryString - The set of query strings to be placed in the redirect URL. Setting this value would replace any existing query string; leave empty to preserve the incoming query string. Query string must be in = format. The first ? and & will be added automatically so do not include them in the front, but do separate multiple query strings with &. - CustomQueryString *string `json:"customQueryString,omitempty"` - // OdataType - Possible values include: 'OdataTypeRouteConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration' - OdataType OdataType `json:"@odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RedirectConfiguration. -func (rc RedirectConfiguration) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration - objectMap := make(map[string]interface{}) - if rc.RedirectType != "" { - objectMap["redirectType"] = rc.RedirectType - } - if rc.RedirectProtocol != "" { - objectMap["redirectProtocol"] = rc.RedirectProtocol - } - if rc.CustomHost != nil { - objectMap["customHost"] = rc.CustomHost - } - if rc.CustomPath != nil { - objectMap["customPath"] = rc.CustomPath - } - if rc.CustomFragment != nil { - objectMap["customFragment"] = rc.CustomFragment - } - if rc.CustomQueryString != nil { - objectMap["customQueryString"] = rc.CustomQueryString - } - if rc.OdataType != "" { - objectMap["@odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsForwardingConfiguration is the BasicRouteConfiguration implementation for RedirectConfiguration. -func (rc RedirectConfiguration) AsForwardingConfiguration() (*ForwardingConfiguration, bool) { - return nil, false -} - -// AsRedirectConfiguration is the BasicRouteConfiguration implementation for RedirectConfiguration. -func (rc RedirectConfiguration) AsRedirectConfiguration() (*RedirectConfiguration, bool) { - return &rc, true -} - -// AsRouteConfiguration is the BasicRouteConfiguration implementation for RedirectConfiguration. -func (rc RedirectConfiguration) AsRouteConfiguration() (*RouteConfiguration, bool) { - return nil, false -} - -// AsBasicRouteConfiguration is the BasicRouteConfiguration implementation for RedirectConfiguration. -func (rc RedirectConfiguration) AsBasicRouteConfiguration() (BasicRouteConfiguration, bool) { - return &rc, true -} - -// Resource common resource representation. -type Resource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// BasicRouteConfiguration base class for all types of Route. -type BasicRouteConfiguration interface { - AsForwardingConfiguration() (*ForwardingConfiguration, bool) - AsRedirectConfiguration() (*RedirectConfiguration, bool) - AsRouteConfiguration() (*RouteConfiguration, bool) -} - -// RouteConfiguration base class for all types of Route. -type RouteConfiguration struct { - // OdataType - Possible values include: 'OdataTypeRouteConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration' - OdataType OdataType `json:"@odata.type,omitempty"` -} - -func unmarshalBasicRouteConfiguration(body []byte) (BasicRouteConfiguration, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["@odata.type"] { - case string(OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration): - var fc ForwardingConfiguration - err := json.Unmarshal(body, &fc) - return fc, err - case string(OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration): - var rc RedirectConfiguration - err := json.Unmarshal(body, &rc) - return rc, err - default: - var rc RouteConfiguration - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRouteConfigurationArray(body []byte) ([]BasicRouteConfiguration, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRouteConfiguration, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRouteConfiguration(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RouteConfiguration. -func (rc RouteConfiguration) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeRouteConfiguration - objectMap := make(map[string]interface{}) - if rc.OdataType != "" { - objectMap["@odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsForwardingConfiguration is the BasicRouteConfiguration implementation for RouteConfiguration. -func (rc RouteConfiguration) AsForwardingConfiguration() (*ForwardingConfiguration, bool) { - return nil, false -} - -// AsRedirectConfiguration is the BasicRouteConfiguration implementation for RouteConfiguration. -func (rc RouteConfiguration) AsRedirectConfiguration() (*RedirectConfiguration, bool) { - return nil, false -} - -// AsRouteConfiguration is the BasicRouteConfiguration implementation for RouteConfiguration. -func (rc RouteConfiguration) AsRouteConfiguration() (*RouteConfiguration, bool) { - return &rc, true -} - -// AsBasicRouteConfiguration is the BasicRouteConfiguration implementation for RouteConfiguration. -func (rc RouteConfiguration) AsBasicRouteConfiguration() (BasicRouteConfiguration, bool) { - return &rc, true -} - -// RoutingRule a routing rule represents a specification for traffic to treat and where to send it, along -// with health probe information. -type RoutingRule struct { - // RoutingRuleProperties - Properties of the Front Door Routing Rule - *RoutingRuleProperties `json:"properties,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for RoutingRule. -func (rr RoutingRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rr.RoutingRuleProperties != nil { - objectMap["properties"] = rr.RoutingRuleProperties - } - if rr.Name != nil { - objectMap["name"] = rr.Name - } - if rr.ID != nil { - objectMap["id"] = rr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RoutingRule struct. -func (rr *RoutingRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var routingRuleProperties RoutingRuleProperties - err = json.Unmarshal(*v, &routingRuleProperties) - if err != nil { - return err - } - rr.RoutingRuleProperties = &routingRuleProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rr.ID = &ID - } - } - } - - return nil -} - -// RoutingRuleLink defines the Resource ID for a Routing Rule. -type RoutingRuleLink struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// RoutingRuleListResult result of the request to list Routing Rules. It contains a list of Routing Rule -// objects and a URL link to get the next set of results. -type RoutingRuleListResult struct { - // Value - READ-ONLY; List of Routing Rules within a Front Door. - Value *[]RoutingRule `json:"value,omitempty"` - // NextLink - URL to get the next set of RoutingRule objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RoutingRuleListResult. -func (rrlr RoutingRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rrlr.NextLink != nil { - objectMap["nextLink"] = rrlr.NextLink - } - return json.Marshal(objectMap) -} - -// RoutingRuleProperties the JSON object that contains the properties required to create a routing rule. -type RoutingRuleProperties struct { - // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' - ResourceState ResourceState `json:"resourceState,omitempty"` - // FrontendEndpoints - Frontend endpoints associated with this rule - FrontendEndpoints *[]SubResource `json:"frontendEndpoints,omitempty"` - // AcceptedProtocols - Protocol schemes to match for this rule - AcceptedProtocols *[]Protocol `json:"acceptedProtocols,omitempty"` - // PatternsToMatch - The route patterns of the rule. - PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` - // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'RoutingRuleEnabledStateEnabled', 'RoutingRuleEnabledStateDisabled' - EnabledState RoutingRuleEnabledState `json:"enabledState,omitempty"` - // RouteConfiguration - A reference to the routing configuration. - RouteConfiguration BasicRouteConfiguration `json:"routeConfiguration,omitempty"` - // RulesEngine - A reference to a specific Rules Engine Configuration to apply to this route. - RulesEngine *SubResource `json:"rulesEngine,omitempty"` - // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for each routing rule (if applicable) - WebApplicationFirewallPolicyLink *RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for RoutingRuleProperties struct. -func (rrp *RoutingRuleProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "resourceState": - if v != nil { - var resourceState ResourceState - err = json.Unmarshal(*v, &resourceState) - if err != nil { - return err - } - rrp.ResourceState = resourceState - } - case "frontendEndpoints": - if v != nil { - var frontendEndpoints []SubResource - err = json.Unmarshal(*v, &frontendEndpoints) - if err != nil { - return err - } - rrp.FrontendEndpoints = &frontendEndpoints - } - case "acceptedProtocols": - if v != nil { - var acceptedProtocols []Protocol - err = json.Unmarshal(*v, &acceptedProtocols) - if err != nil { - return err - } - rrp.AcceptedProtocols = &acceptedProtocols - } - case "patternsToMatch": - if v != nil { - var patternsToMatch []string - err = json.Unmarshal(*v, &patternsToMatch) - if err != nil { - return err - } - rrp.PatternsToMatch = &patternsToMatch - } - case "enabledState": - if v != nil { - var enabledState RoutingRuleEnabledState - err = json.Unmarshal(*v, &enabledState) - if err != nil { - return err - } - rrp.EnabledState = enabledState - } - case "routeConfiguration": - if v != nil { - routeConfiguration, err := unmarshalBasicRouteConfiguration(*v) - if err != nil { - return err - } - rrp.RouteConfiguration = routeConfiguration - } - case "rulesEngine": - if v != nil { - var rulesEngine SubResource - err = json.Unmarshal(*v, &rulesEngine) - if err != nil { - return err - } - rrp.RulesEngine = &rulesEngine - } - case "webApplicationFirewallPolicyLink": - if v != nil { - var webApplicationFirewallPolicyLink RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink - err = json.Unmarshal(*v, &webApplicationFirewallPolicyLink) - if err != nil { - return err - } - rrp.WebApplicationFirewallPolicyLink = &webApplicationFirewallPolicyLink - } - } - } - - return nil -} - -// RoutingRuleUpdateParameters routing rules to apply to an endpoint -type RoutingRuleUpdateParameters struct { - // FrontendEndpoints - Frontend endpoints associated with this rule - FrontendEndpoints *[]SubResource `json:"frontendEndpoints,omitempty"` - // AcceptedProtocols - Protocol schemes to match for this rule - AcceptedProtocols *[]Protocol `json:"acceptedProtocols,omitempty"` - // PatternsToMatch - The route patterns of the rule. - PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` - // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'RoutingRuleEnabledStateEnabled', 'RoutingRuleEnabledStateDisabled' - EnabledState RoutingRuleEnabledState `json:"enabledState,omitempty"` - // RouteConfiguration - A reference to the routing configuration. - RouteConfiguration BasicRouteConfiguration `json:"routeConfiguration,omitempty"` - // RulesEngine - A reference to a specific Rules Engine Configuration to apply to this route. - RulesEngine *SubResource `json:"rulesEngine,omitempty"` - // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for each routing rule (if applicable) - WebApplicationFirewallPolicyLink *RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for RoutingRuleUpdateParameters struct. -func (rrup *RoutingRuleUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "frontendEndpoints": - if v != nil { - var frontendEndpoints []SubResource - err = json.Unmarshal(*v, &frontendEndpoints) - if err != nil { - return err - } - rrup.FrontendEndpoints = &frontendEndpoints - } - case "acceptedProtocols": - if v != nil { - var acceptedProtocols []Protocol - err = json.Unmarshal(*v, &acceptedProtocols) - if err != nil { - return err - } - rrup.AcceptedProtocols = &acceptedProtocols - } - case "patternsToMatch": - if v != nil { - var patternsToMatch []string - err = json.Unmarshal(*v, &patternsToMatch) - if err != nil { - return err - } - rrup.PatternsToMatch = &patternsToMatch - } - case "enabledState": - if v != nil { - var enabledState RoutingRuleEnabledState - err = json.Unmarshal(*v, &enabledState) - if err != nil { - return err - } - rrup.EnabledState = enabledState - } - case "routeConfiguration": - if v != nil { - routeConfiguration, err := unmarshalBasicRouteConfiguration(*v) - if err != nil { - return err - } - rrup.RouteConfiguration = routeConfiguration - } - case "rulesEngine": - if v != nil { - var rulesEngine SubResource - err = json.Unmarshal(*v, &rulesEngine) - if err != nil { - return err - } - rrup.RulesEngine = &rulesEngine - } - case "webApplicationFirewallPolicyLink": - if v != nil { - var webApplicationFirewallPolicyLink RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink - err = json.Unmarshal(*v, &webApplicationFirewallPolicyLink) - if err != nil { - return err - } - rrup.WebApplicationFirewallPolicyLink = &webApplicationFirewallPolicyLink - } - } - } - - return nil -} - -// RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink defines the Web Application Firewall policy -// for each routing rule (if applicable) -type RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// RulesEngine a rules engine configuration containing a list of rules that will run to modify the runtime -// behavior of the request and response. -type RulesEngine struct { - autorest.Response `json:"-"` - // RulesEngineProperties - Properties of the Rules Engine Configuration. - *RulesEngineProperties `json:"properties,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for RulesEngine. -func (re RulesEngine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if re.RulesEngineProperties != nil { - objectMap["properties"] = re.RulesEngineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RulesEngine struct. -func (re *RulesEngine) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var rulesEngineProperties RulesEngineProperties - err = json.Unmarshal(*v, &rulesEngineProperties) - if err != nil { - return err - } - re.RulesEngineProperties = &rulesEngineProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - re.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - re.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - re.ID = &ID - } - } - } - - return nil -} - -// RulesEngineAction one or more actions that will execute, modifying the request and/or response. -type RulesEngineAction struct { - // RequestHeaderActions - A list of header actions to apply from the request from AFD to the origin. - RequestHeaderActions *[]HeaderAction `json:"requestHeaderActions,omitempty"` - // ResponseHeaderActions - A list of header actions to apply from the response from AFD to the client. - ResponseHeaderActions *[]HeaderAction `json:"responseHeaderActions,omitempty"` - // RouteConfigurationOverride - Override the route configuration. - RouteConfigurationOverride BasicRouteConfiguration `json:"routeConfigurationOverride,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for RulesEngineAction struct. -func (rea *RulesEngineAction) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "requestHeaderActions": - if v != nil { - var requestHeaderActions []HeaderAction - err = json.Unmarshal(*v, &requestHeaderActions) - if err != nil { - return err - } - rea.RequestHeaderActions = &requestHeaderActions - } - case "responseHeaderActions": - if v != nil { - var responseHeaderActions []HeaderAction - err = json.Unmarshal(*v, &responseHeaderActions) - if err != nil { - return err - } - rea.ResponseHeaderActions = &responseHeaderActions - } - case "routeConfigurationOverride": - if v != nil { - routeConfigurationOverride, err := unmarshalBasicRouteConfiguration(*v) - if err != nil { - return err - } - rea.RouteConfigurationOverride = routeConfigurationOverride - } - } - } - - return nil -} - -// RulesEngineListResult result of the request to list Rules Engine Configurations. It contains a list of -// RulesEngine objects and a URL link to get the next set of results. -type RulesEngineListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of rulesEngines within a Front Door. - Value *[]RulesEngine `json:"value,omitempty"` - // NextLink - URL to get the next set of RulesEngine objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RulesEngineListResult. -func (relr RulesEngineListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if relr.NextLink != nil { - objectMap["nextLink"] = relr.NextLink - } - return json.Marshal(objectMap) -} - -// RulesEngineListResultIterator provides access to a complete listing of RulesEngine values. -type RulesEngineListResultIterator struct { - i int - page RulesEngineListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RulesEngineListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesEngineListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RulesEngineListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RulesEngineListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RulesEngineListResultIterator) Response() RulesEngineListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RulesEngineListResultIterator) Value() RulesEngine { - if !iter.page.NotDone() { - return RulesEngine{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RulesEngineListResultIterator type. -func NewRulesEngineListResultIterator(page RulesEngineListResultPage) RulesEngineListResultIterator { - return RulesEngineListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (relr RulesEngineListResult) IsEmpty() bool { - return relr.Value == nil || len(*relr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (relr RulesEngineListResult) hasNextLink() bool { - return relr.NextLink != nil && len(*relr.NextLink) != 0 -} - -// rulesEngineListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (relr RulesEngineListResult) rulesEngineListResultPreparer(ctx context.Context) (*http.Request, error) { - if !relr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(relr.NextLink))) -} - -// RulesEngineListResultPage contains a page of RulesEngine values. -type RulesEngineListResultPage struct { - fn func(context.Context, RulesEngineListResult) (RulesEngineListResult, error) - relr RulesEngineListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RulesEngineListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesEngineListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.relr) - if err != nil { - return err - } - page.relr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RulesEngineListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RulesEngineListResultPage) NotDone() bool { - return !page.relr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RulesEngineListResultPage) Response() RulesEngineListResult { - return page.relr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RulesEngineListResultPage) Values() []RulesEngine { - if page.relr.IsEmpty() { - return nil - } - return *page.relr.Value -} - -// Creates a new instance of the RulesEngineListResultPage type. -func NewRulesEngineListResultPage(cur RulesEngineListResult, getNextPage func(context.Context, RulesEngineListResult) (RulesEngineListResult, error)) RulesEngineListResultPage { - return RulesEngineListResultPage{ - fn: getNextPage, - relr: cur, - } -} - -// RulesEngineMatchCondition define a match condition -type RulesEngineMatchCondition struct { - // RulesEngineMatchVariable - Match Variable. Possible values include: 'RulesEngineMatchVariableIsMobile', 'RulesEngineMatchVariableRemoteAddr', 'RulesEngineMatchVariableRequestMethod', 'RulesEngineMatchVariableQueryString', 'RulesEngineMatchVariablePostArgs', 'RulesEngineMatchVariableRequestURI', 'RulesEngineMatchVariableRequestPath', 'RulesEngineMatchVariableRequestFilename', 'RulesEngineMatchVariableRequestFilenameExtension', 'RulesEngineMatchVariableRequestHeader', 'RulesEngineMatchVariableRequestBody', 'RulesEngineMatchVariableRequestScheme' - RulesEngineMatchVariable RulesEngineMatchVariable `json:"rulesEngineMatchVariable,omitempty"` - // Selector - Name of selector in RequestHeader or RequestBody to be matched - Selector *string `json:"selector,omitempty"` - // RulesEngineOperator - Describes operator to apply to the match condition. Possible values include: 'RulesEngineOperatorAny', 'RulesEngineOperatorIPMatch', 'RulesEngineOperatorGeoMatch', 'RulesEngineOperatorEqual', 'RulesEngineOperatorContains', 'RulesEngineOperatorLessThan', 'RulesEngineOperatorGreaterThan', 'RulesEngineOperatorLessThanOrEqual', 'RulesEngineOperatorGreaterThanOrEqual', 'RulesEngineOperatorBeginsWith', 'RulesEngineOperatorEndsWith' - RulesEngineOperator RulesEngineOperator `json:"rulesEngineOperator,omitempty"` - // NegateCondition - Describes if this is negate condition or not - NegateCondition *bool `json:"negateCondition,omitempty"` - // RulesEngineMatchValue - Match values to match against. The operator will apply to each value in here with OR semantics. If any of them match the variable with the given operator this match condition is considered a match. - RulesEngineMatchValue *[]string `json:"rulesEngineMatchValue,omitempty"` - // Transforms - List of transforms - Transforms *[]Transform `json:"transforms,omitempty"` -} - -// RulesEngineProperties the JSON object that contains the properties required to create a Rules Engine -// Configuration. -type RulesEngineProperties struct { - // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' - ResourceState ResourceState `json:"resourceState,omitempty"` - // Rules - A list of rules that define a particular Rules Engine Configuration. - Rules *[]RulesEngineRule `json:"rules,omitempty"` -} - -// RulesEngineRule contains a list of match conditions, and an action on how to modify the -// request/response. If multiple rules match, the actions from one rule that conflict with a previous rule -// overwrite for a singular action, or append in the case of headers manipulation. -type RulesEngineRule struct { - // Name - A name to refer to this specific rule. - Name *string `json:"name,omitempty"` - // Priority - A priority assigned to this rule. - Priority *int32 `json:"priority,omitempty"` - // Action - Actions to perform on the request and response if all of the match conditions are met. - Action *RulesEngineAction `json:"action,omitempty"` - // MatchConditions - A list of match conditions that must meet in order for the actions of this rule to run. Having no match conditions means the actions will always run. - MatchConditions *[]RulesEngineMatchCondition `json:"matchConditions,omitempty"` - // MatchProcessingBehavior - If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. Possible values include: 'MatchProcessingBehaviorContinue', 'MatchProcessingBehaviorStop' - MatchProcessingBehavior MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` -} - -// RulesEnginesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RulesEnginesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RulesEnginesClient) (RulesEngine, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RulesEnginesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RulesEnginesCreateOrUpdateFuture.Result. -func (future *RulesEnginesCreateOrUpdateFuture) result(client RulesEnginesClient) (re RulesEngine, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - re.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.RulesEnginesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if re.Response.Response, err = future.GetResult(sender); err == nil && re.Response.Response.StatusCode != http.StatusNoContent { - re, err = client.CreateOrUpdateResponder(re.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesCreateOrUpdateFuture", "Result", re.Response.Response, "Failure responding to request") - } - } - return -} - -// RulesEnginesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RulesEnginesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RulesEnginesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RulesEnginesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RulesEnginesDeleteFuture.Result. -func (future *RulesEnginesDeleteFuture) result(client RulesEnginesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("frontdoor.RulesEnginesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RulesEngineUpdateParameters rules Engine Configuration to apply to a Routing Rule. -type RulesEngineUpdateParameters struct { - // Rules - A list of rules that define a particular Rules Engine Configuration. - Rules *[]RulesEngineRule `json:"rules,omitempty"` -} - -// SecurityPolicyLink defines the Resource ID for a Security Policy. -type SecurityPolicyLink struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// Sku the pricing tier of the web application firewall policy. -type Sku struct { - // Name - Name of the pricing tier. Possible values include: 'SkuNameClassicAzureFrontDoor', 'SkuNameStandardAzureFrontDoor', 'SkuNamePremiumAzureFrontDoor' - Name SkuName `json:"name,omitempty"` -} - -// SubResource reference to another subresource. -type SubResource struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// TagsObject tags object for patch operations. -type TagsObject struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TagsObject. -func (toVar TagsObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if toVar.Tags != nil { - objectMap["tags"] = toVar.Tags - } - return json.Marshal(objectMap) -} - -// Timeseries defines the Timeseries -type Timeseries struct { - autorest.Response `json:"-"` - // TimeseriesProperties - The properties of a Timeseries - *TimeseriesProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Timeseries. -func (t Timeseries) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TimeseriesProperties != nil { - objectMap["properties"] = t.TimeseriesProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Timeseries struct. -func (t *Timeseries) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var timeseriesProperties TimeseriesProperties - err = json.Unmarshal(*v, ×eriesProperties) - if err != nil { - return err - } - t.TimeseriesProperties = ×eriesProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - } - } - - return nil -} - -// TimeseriesDataPoint defines a timeseries datapoint used in a timeseries -type TimeseriesDataPoint struct { - // DateTimeUTC - The DateTime of the Timeseries data point in UTC - DateTimeUTC *string `json:"dateTimeUTC,omitempty"` - // Value - The Value of the Timeseries data point - Value *float64 `json:"value,omitempty"` -} - -// TimeseriesProperties defines the properties of a timeseries -type TimeseriesProperties struct { - // Endpoint - The endpoint associated with the Timeseries data point - Endpoint *string `json:"endpoint,omitempty"` - // StartDateTimeUTC - The start DateTime of the Timeseries in UTC - StartDateTimeUTC *string `json:"startDateTimeUTC,omitempty"` - // EndDateTimeUTC - The end DateTime of the Timeseries in UTC - EndDateTimeUTC *string `json:"endDateTimeUTC,omitempty"` - // AggregationInterval - The aggregation interval of the Timeseries. Possible values include: 'AggregationIntervalHourly', 'AggregationIntervalDaily' - AggregationInterval AggregationInterval `json:"aggregationInterval,omitempty"` - // TimeseriesType - The type of Timeseries. Possible values include: 'TimeseriesTypeMeasurementCounts', 'TimeseriesTypeLatencyP50', 'TimeseriesTypeLatencyP75', 'TimeseriesTypeLatencyP95' - TimeseriesType TimeseriesType `json:"timeseriesType,omitempty"` - // Country - The country associated with the Timeseries. Values are country ISO codes as specified here- https://www.iso.org/iso-3166-country-codes.html - Country *string `json:"country,omitempty"` - // TimeseriesData - The set of data points for the timeseries - TimeseriesData *[]TimeseriesDataPoint `json:"timeseriesData,omitempty"` -} - -// UpdateParameters the properties needed to update a Front Door -type UpdateParameters struct { - // FriendlyName - A friendly name for the frontDoor - FriendlyName *string `json:"friendlyName,omitempty"` - // RoutingRules - Routing rules associated with this Front Door. - RoutingRules *[]RoutingRule `json:"routingRules,omitempty"` - // LoadBalancingSettings - Load balancing settings associated with this Front Door instance. - LoadBalancingSettings *[]LoadBalancingSettingsModel `json:"loadBalancingSettings,omitempty"` - // HealthProbeSettings - Health probe settings associated with this Front Door instance. - HealthProbeSettings *[]HealthProbeSettingsModel `json:"healthProbeSettings,omitempty"` - // BackendPools - Backend pools available to routing rules. - BackendPools *[]BackendPool `json:"backendPools,omitempty"` - // FrontendEndpoints - Frontend endpoints available to routing rules. - FrontendEndpoints *[]FrontendEndpoint `json:"frontendEndpoints,omitempty"` - // BackendPoolsSettings - Settings for all backendPools - BackendPoolsSettings *BackendPoolsSettings `json:"backendPoolsSettings,omitempty"` - // EnabledState - Operational status of the Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' - EnabledState EnabledState `json:"enabledState,omitempty"` -} - -// ValidateCustomDomainInput input of the custom domain to be validated for DNS mapping. -type ValidateCustomDomainInput struct { - // HostName - The host name of the custom domain. Must be a domain name. - HostName *string `json:"hostName,omitempty"` -} - -// ValidateCustomDomainOutput output of custom domain validation. -type ValidateCustomDomainOutput struct { - autorest.Response `json:"-"` - // CustomDomainValidated - READ-ONLY; Indicates whether the custom domain is valid or not. - CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` - // Reason - READ-ONLY; The reason why the custom domain is not valid. - Reason *string `json:"reason,omitempty"` - // Message - READ-ONLY; Error message describing why the custom domain is not valid. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ValidateCustomDomainOutput. -func (vcdo ValidateCustomDomainOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WebApplicationFirewallPolicy defines web application firewall policy. -type WebApplicationFirewallPolicy struct { - autorest.Response `json:"-"` - // WebApplicationFirewallPolicyProperties - Properties of the web application firewall policy. - *WebApplicationFirewallPolicyProperties `json:"properties,omitempty"` - // Etag - Gets a unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Sku - The pricing tier of web application firewall policy. Defaults to Classic_AzureFrontDoor if not specified. - Sku *Sku `json:"sku,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicy. -func (wafp WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wafp.WebApplicationFirewallPolicyProperties != nil { - objectMap["properties"] = wafp.WebApplicationFirewallPolicyProperties - } - if wafp.Etag != nil { - objectMap["etag"] = wafp.Etag - } - if wafp.Sku != nil { - objectMap["sku"] = wafp.Sku - } - if wafp.Location != nil { - objectMap["location"] = wafp.Location - } - if wafp.Tags != nil { - objectMap["tags"] = wafp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebApplicationFirewallPolicy struct. -func (wafp *WebApplicationFirewallPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var webApplicationFirewallPolicyProperties WebApplicationFirewallPolicyProperties - err = json.Unmarshal(*v, &webApplicationFirewallPolicyProperties) - if err != nil { - return err - } - wafp.WebApplicationFirewallPolicyProperties = &webApplicationFirewallPolicyProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - wafp.Etag = &etag - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - wafp.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wafp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wafp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wafp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wafp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - wafp.Tags = tags - } - } - } - - return nil -} - -// WebApplicationFirewallPolicyList defines a list of WebApplicationFirewallPolicies. It contains a list of -// WebApplicationFirewallPolicy objects and a URL link to get the next set of results. -type WebApplicationFirewallPolicyList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of WebApplicationFirewallPolicies within a resource group. - Value *[]WebApplicationFirewallPolicy `json:"value,omitempty"` - // NextLink - URL to get the next set of WebApplicationFirewallPolicy objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyList. -func (wafpl WebApplicationFirewallPolicyList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wafpl.NextLink != nil { - objectMap["nextLink"] = wafpl.NextLink - } - return json.Marshal(objectMap) -} - -// WebApplicationFirewallPolicyListIterator provides access to a complete listing of -// WebApplicationFirewallPolicy values. -type WebApplicationFirewallPolicyListIterator struct { - i int - page WebApplicationFirewallPolicyListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WebApplicationFirewallPolicyListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WebApplicationFirewallPolicyListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebApplicationFirewallPolicyListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WebApplicationFirewallPolicyListIterator) Response() WebApplicationFirewallPolicyList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WebApplicationFirewallPolicyListIterator) Value() WebApplicationFirewallPolicy { - if !iter.page.NotDone() { - return WebApplicationFirewallPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebApplicationFirewallPolicyListIterator type. -func NewWebApplicationFirewallPolicyListIterator(page WebApplicationFirewallPolicyListPage) WebApplicationFirewallPolicyListIterator { - return WebApplicationFirewallPolicyListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wafpl WebApplicationFirewallPolicyList) IsEmpty() bool { - return wafpl.Value == nil || len(*wafpl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wafpl WebApplicationFirewallPolicyList) hasNextLink() bool { - return wafpl.NextLink != nil && len(*wafpl.NextLink) != 0 -} - -// webApplicationFirewallPolicyListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wafpl WebApplicationFirewallPolicyList) webApplicationFirewallPolicyListPreparer(ctx context.Context) (*http.Request, error) { - if !wafpl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wafpl.NextLink))) -} - -// WebApplicationFirewallPolicyListPage contains a page of WebApplicationFirewallPolicy values. -type WebApplicationFirewallPolicyListPage struct { - fn func(context.Context, WebApplicationFirewallPolicyList) (WebApplicationFirewallPolicyList, error) - wafpl WebApplicationFirewallPolicyList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WebApplicationFirewallPolicyListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wafpl) - if err != nil { - return err - } - page.wafpl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WebApplicationFirewallPolicyListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebApplicationFirewallPolicyListPage) NotDone() bool { - return !page.wafpl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebApplicationFirewallPolicyListPage) Response() WebApplicationFirewallPolicyList { - return page.wafpl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebApplicationFirewallPolicyListPage) Values() []WebApplicationFirewallPolicy { - if page.wafpl.IsEmpty() { - return nil - } - return *page.wafpl.Value -} - -// Creates a new instance of the WebApplicationFirewallPolicyListPage type. -func NewWebApplicationFirewallPolicyListPage(cur WebApplicationFirewallPolicyList, getNextPage func(context.Context, WebApplicationFirewallPolicyList) (WebApplicationFirewallPolicyList, error)) WebApplicationFirewallPolicyListPage { - return WebApplicationFirewallPolicyListPage{ - fn: getNextPage, - wafpl: cur, - } -} - -// WebApplicationFirewallPolicyProperties defines web application firewall policy properties. -type WebApplicationFirewallPolicyProperties struct { - // PolicySettings - Describes settings for the policy. - PolicySettings *PolicySettings `json:"policySettings,omitempty"` - // CustomRules - Describes custom rules inside the policy. - CustomRules *CustomRuleList `json:"customRules,omitempty"` - // ManagedRules - Describes managed rules inside the policy. - ManagedRules *ManagedRuleSetList `json:"managedRules,omitempty"` - // FrontendEndpointLinks - READ-ONLY; Describes Frontend Endpoints associated with this Web Application Firewall policy. - FrontendEndpointLinks *[]FrontendEndpointLink `json:"frontendEndpointLinks,omitempty"` - // RoutingRuleLinks - READ-ONLY; Describes Routing Rules associated with this Web Application Firewall policy. - RoutingRuleLinks *[]RoutingRuleLink `json:"routingRuleLinks,omitempty"` - // SecurityPolicyLinks - READ-ONLY; Describes Security Policy associated with this Web Application Firewall policy. - SecurityPolicyLinks *[]SecurityPolicyLink `json:"securityPolicyLinks,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the policy. - ProvisioningState *string `json:"provisioningState,omitempty"` - // ResourceState - READ-ONLY; Possible values include: 'PolicyResourceStateCreating', 'PolicyResourceStateEnabling', 'PolicyResourceStateEnabled', 'PolicyResourceStateDisabling', 'PolicyResourceStateDisabled', 'PolicyResourceStateDeleting' - ResourceState PolicyResourceState `json:"resourceState,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyProperties. -func (wafpp WebApplicationFirewallPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wafpp.PolicySettings != nil { - objectMap["policySettings"] = wafpp.PolicySettings - } - if wafpp.CustomRules != nil { - objectMap["customRules"] = wafpp.CustomRules - } - if wafpp.ManagedRules != nil { - objectMap["managedRules"] = wafpp.ManagedRules - } - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailability.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailability.go deleted file mode 100644 index 22b2c5d9e9a0..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailability.go +++ /dev/null @@ -1,110 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NameAvailabilityClient is the frontDoor Client -type NameAvailabilityClient struct { - BaseClient -} - -// NewNameAvailabilityClient creates an instance of the NameAvailabilityClient client. -func NewNameAvailabilityClient(subscriptionID string) NameAvailabilityClient { - return NewNameAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNameAvailabilityClientWithBaseURI creates an instance of the NameAvailabilityClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewNameAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) NameAvailabilityClient { - return NameAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Check check the availability of a Front Door resource name. -// Parameters: -// checkFrontDoorNameAvailabilityInput - input to check. -func (client NameAvailabilityClient) Check(ctx context.Context, checkFrontDoorNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NameAvailabilityClient.Check") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: checkFrontDoorNameAvailabilityInput, - Constraints: []validation.Constraint{{Target: "checkFrontDoorNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.NameAvailabilityClient", "Check", err.Error()) - } - - req, err := client.CheckPreparer(ctx, checkFrontDoorNameAvailabilityInput) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityClient", "Check", nil, "Failure preparing request") - return - } - - resp, err := client.CheckSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityClient", "Check", resp, "Failure sending request") - return - } - - result, err = client.CheckResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityClient", "Check", resp, "Failure responding to request") - return - } - - return -} - -// CheckPreparer prepares the Check request. -func (client NameAvailabilityClient) CheckPreparer(ctx context.Context, checkFrontDoorNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Network/checkFrontDoorNameAvailability"), - autorest.WithJSON(checkFrontDoorNameAvailabilityInput), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckSender sends the Check request. The method will close the -// http.Response Body if it receives an error. -func (client NameAvailabilityClient) CheckSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CheckResponder handles the response to the Check request. The method always -// closes the http.Response Body. -func (client NameAvailabilityClient) CheckResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailabilitywithsubscription.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailabilitywithsubscription.go deleted file mode 100644 index 9a6a389f05e2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailabilitywithsubscription.go +++ /dev/null @@ -1,114 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NameAvailabilityWithSubscriptionClient is the frontDoor Client -type NameAvailabilityWithSubscriptionClient struct { - BaseClient -} - -// NewNameAvailabilityWithSubscriptionClient creates an instance of the NameAvailabilityWithSubscriptionClient client. -func NewNameAvailabilityWithSubscriptionClient(subscriptionID string) NameAvailabilityWithSubscriptionClient { - return NewNameAvailabilityWithSubscriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNameAvailabilityWithSubscriptionClientWithBaseURI creates an instance of the -// NameAvailabilityWithSubscriptionClient client using a custom endpoint. Use this when interacting with an Azure -// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewNameAvailabilityWithSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) NameAvailabilityWithSubscriptionClient { - return NameAvailabilityWithSubscriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Check check the availability of a Front Door subdomain. -// Parameters: -// checkFrontDoorNameAvailabilityInput - input to check. -func (client NameAvailabilityWithSubscriptionClient) Check(ctx context.Context, checkFrontDoorNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NameAvailabilityWithSubscriptionClient.Check") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: checkFrontDoorNameAvailabilityInput, - Constraints: []validation.Constraint{{Target: "checkFrontDoorNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.NameAvailabilityWithSubscriptionClient", "Check", err.Error()) - } - - req, err := client.CheckPreparer(ctx, checkFrontDoorNameAvailabilityInput) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityWithSubscriptionClient", "Check", nil, "Failure preparing request") - return - } - - resp, err := client.CheckSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityWithSubscriptionClient", "Check", resp, "Failure sending request") - return - } - - result, err = client.CheckResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityWithSubscriptionClient", "Check", resp, "Failure responding to request") - return - } - - return -} - -// CheckPreparer prepares the Check request. -func (client NameAvailabilityWithSubscriptionClient) CheckPreparer(ctx context.Context, checkFrontDoorNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability", pathParameters), - autorest.WithJSON(checkFrontDoorNameAvailabilityInput), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckSender sends the Check request. The method will close the -// http.Response Body if it receives an error. -func (client NameAvailabilityWithSubscriptionClient) CheckSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckResponder handles the response to the Check request. The method always -// closes the http.Response Body. -func (client NameAvailabilityWithSubscriptionClient) CheckResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/networkexperimentprofiles.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/networkexperimentprofiles.go deleted file mode 100644 index 5624dbd4b6a2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/networkexperimentprofiles.go +++ /dev/null @@ -1,628 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NetworkExperimentProfilesClient is the frontDoor Client -type NetworkExperimentProfilesClient struct { - BaseClient -} - -// NewNetworkExperimentProfilesClient creates an instance of the NetworkExperimentProfilesClient client. -func NewNetworkExperimentProfilesClient(subscriptionID string) NetworkExperimentProfilesClient { - return NewNetworkExperimentProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNetworkExperimentProfilesClientWithBaseURI creates an instance of the NetworkExperimentProfilesClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewNetworkExperimentProfilesClientWithBaseURI(baseURI string, subscriptionID string) NetworkExperimentProfilesClient { - return NetworkExperimentProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -// Parameters: -// profileName - the Profile identifier associated with the Tenant and Partner -// resourceGroupName - name of the Resource group within the Azure subscription. -// parameters - an Network Experiment Profile -func (client NetworkExperimentProfilesClient) CreateOrUpdate(ctx context.Context, profileName string, resourceGroupName string, parameters Profile) (result NetworkExperimentProfilesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, profileName, resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NetworkExperimentProfilesClient) CreateOrUpdatePreparer(ctx context.Context, profileName string, resourceGroupName string, parameters Profile) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkExperimentProfilesClient) CreateOrUpdateSender(req *http.Request) (future NetworkExperimentProfilesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NetworkExperimentProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result Profile, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete sends the delete request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -func (client NetworkExperimentProfilesClient) Delete(ctx context.Context, resourceGroupName string, profileName string) (result NetworkExperimentProfilesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NetworkExperimentProfilesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkExperimentProfilesClient) DeleteSender(req *http.Request) (future NetworkExperimentProfilesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NetworkExperimentProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -func (client NetworkExperimentProfilesClient) Get(ctx context.Context, resourceGroupName string, profileName string) (result Profile, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NetworkExperimentProfilesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkExperimentProfilesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NetworkExperimentProfilesClient) GetResponder(resp *http.Response) (result Profile, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -func (client NetworkExperimentProfilesClient) List(ctx context.Context) (result ProfileListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.List") - defer func() { - sc := -1 - if result.pl.Response.Response != nil { - sc = result.pl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "List", resp, "Failure sending request") - return - } - - result.pl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "List", resp, "Failure responding to request") - return - } - if result.pl.hasNextLink() && result.pl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client NetworkExperimentProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkExperimentProfilesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client NetworkExperimentProfilesClient) ListResponder(resp *http.Response) (result ProfileList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client NetworkExperimentProfilesClient) listNextResults(ctx context.Context, lastResults ProfileList) (result ProfileList, err error) { - req, err := lastResults.profileListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client NetworkExperimentProfilesClient) ListComplete(ctx context.Context) (result ProfileListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup sends the list by resource group request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -func (client NetworkExperimentProfilesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ProfileListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.pl.Response.Response != nil { - sc = result.pl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.pl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.pl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.pl.hasNextLink() && result.pl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client NetworkExperimentProfilesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkExperimentProfilesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client NetworkExperimentProfilesClient) ListByResourceGroupResponder(resp *http.Response) (result ProfileList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client NetworkExperimentProfilesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ProfileList) (result ProfileList, err error) { - req, err := lastResults.profileListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client NetworkExperimentProfilesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ProfileListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Update updates an NetworkExperimentProfiles -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -// parameters - the Profile Update Model -func (client NetworkExperimentProfilesClient) Update(ctx context.Context, resourceGroupName string, profileName string, parameters ProfileUpdateModel) (result NetworkExperimentProfilesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client NetworkExperimentProfilesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, parameters ProfileUpdateModel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkExperimentProfilesClient) UpdateSender(req *http.Request) (future NetworkExperimentProfilesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client NetworkExperimentProfilesClient) UpdateResponder(resp *http.Response) (result Profile, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/policies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/policies.go deleted file mode 100644 index 10dfed377773..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/policies.go +++ /dev/null @@ -1,429 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PoliciesClient is the frontDoor Client -type PoliciesClient struct { - BaseClient -} - -// NewPoliciesClient creates an instance of the PoliciesClient client. -func NewPoliciesClient(subscriptionID string) PoliciesClient { - return NewPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPoliciesClientWithBaseURI creates an instance of the PoliciesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { - return PoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update policy with specified rule set name within a resource group. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// policyName - the name of the Web Application Firewall Policy. -// parameters - policy to be created. -func (client PoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, policyName string, parameters WebApplicationFirewallPolicy) (result PoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: policyName, - Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyProperties.PolicySettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyProperties.PolicySettings.CustomBlockResponseBody", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyProperties.PolicySettings.CustomBlockResponseBody", Name: validation.Pattern, Rule: `^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$`, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("frontdoor.PoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, policyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, policyName string, parameters WebApplicationFirewallPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyName": autorest.Encode("path", policyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) CreateOrUpdateSender(req *http.Request) (future PoliciesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes Policy -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// policyName - the name of the Web Application Firewall Policy. -func (client PoliciesClient) Delete(ctx context.Context, resourceGroupName string, policyName string) (result PoliciesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: policyName, - Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.PoliciesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, policyName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyName": autorest.Encode("path", policyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) DeleteSender(req *http.Request) (future PoliciesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve protection policy with specified name within a resource group. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// policyName - the name of the Web Application Firewall Policy. -func (client PoliciesClient) Get(ctx context.Context, resourceGroupName string, policyName string) (result WebApplicationFirewallPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: policyName, - Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.PoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, policyName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyName": autorest.Encode("path", policyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PoliciesClient) GetResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the protection policies within a resource group. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -func (client PoliciesClient) List(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") - defer func() { - sc := -1 - if result.wafpl.Response.Response != nil { - sc = result.wafpl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.PoliciesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wafpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "List", resp, "Failure sending request") - return - } - - result.wafpl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "List", resp, "Failure responding to request") - return - } - if result.wafpl.hasNextLink() && result.wafpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PoliciesClient) ListResponder(resp *http.Response) (result WebApplicationFirewallPolicyList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client PoliciesClient) listNextResults(ctx context.Context, lastResults WebApplicationFirewallPolicyList) (result WebApplicationFirewallPolicyList, err error) { - req, err := lastResults.webApplicationFirewallPolicyListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PoliciesClient) ListComplete(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/preconfiguredendpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/preconfiguredendpoints.go deleted file mode 100644 index d84ba2d8e6fd..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/preconfiguredendpoints.go +++ /dev/null @@ -1,161 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PreconfiguredEndpointsClient is the frontDoor Client -type PreconfiguredEndpointsClient struct { - BaseClient -} - -// NewPreconfiguredEndpointsClient creates an instance of the PreconfiguredEndpointsClient client. -func NewPreconfiguredEndpointsClient(subscriptionID string) PreconfiguredEndpointsClient { - return NewPreconfiguredEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPreconfiguredEndpointsClientWithBaseURI creates an instance of the PreconfiguredEndpointsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewPreconfiguredEndpointsClientWithBaseURI(baseURI string, subscriptionID string) PreconfiguredEndpointsClient { - return PreconfiguredEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List sends the list request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -func (client PreconfiguredEndpointsClient) List(ctx context.Context, resourceGroupName string, profileName string) (result PreconfiguredEndpointListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PreconfiguredEndpointsClient.List") - defer func() { - sc := -1 - if result.pel.Response.Response != nil { - sc = result.pel.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.PreconfiguredEndpointsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pel.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "List", resp, "Failure sending request") - return - } - - result.pel, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "List", resp, "Failure responding to request") - return - } - if result.pel.hasNextLink() && result.pel.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PreconfiguredEndpointsClient) ListPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/PreconfiguredEndpoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PreconfiguredEndpointsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PreconfiguredEndpointsClient) ListResponder(resp *http.Response) (result PreconfiguredEndpointList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client PreconfiguredEndpointsClient) listNextResults(ctx context.Context, lastResults PreconfiguredEndpointList) (result PreconfiguredEndpointList, err error) { - req, err := lastResults.preconfiguredEndpointListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PreconfiguredEndpointsClient) ListComplete(ctx context.Context, resourceGroupName string, profileName string) (result PreconfiguredEndpointListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PreconfiguredEndpointsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, profileName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/reports.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/reports.go deleted file mode 100644 index 3a95b12e4389..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/reports.go +++ /dev/null @@ -1,241 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ReportsClient is the frontDoor Client -type ReportsClient struct { - BaseClient -} - -// NewReportsClient creates an instance of the ReportsClient client. -func NewReportsClient(subscriptionID string) ReportsClient { - return NewReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReportsClientWithBaseURI creates an instance of the ReportsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewReportsClientWithBaseURI(baseURI string, subscriptionID string) ReportsClient { - return ReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetLatencyScorecards sends the get latency scorecards request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -// experimentName - the Experiment identifier associated with the Experiment -// aggregationInterval - the aggregation interval of the Latency Scorecard -// endDateTimeUTC - the end DateTime of the Latency Scorecard in UTC -// country - the country associated with the Latency Scorecard. Values are country ISO codes as specified here- -// https://www.iso.org/iso-3166-country-codes.html -func (client ReportsClient) GetLatencyScorecards(ctx context.Context, resourceGroupName string, profileName string, experimentName string, aggregationInterval LatencyScorecardAggregationInterval, endDateTimeUTC string, country string) (result LatencyScorecard, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.GetLatencyScorecards") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: experimentName, - Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.ReportsClient", "GetLatencyScorecards", err.Error()) - } - - req, err := client.GetLatencyScorecardsPreparer(ctx, resourceGroupName, profileName, experimentName, aggregationInterval, endDateTimeUTC, country) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetLatencyScorecards", nil, "Failure preparing request") - return - } - - resp, err := client.GetLatencyScorecardsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetLatencyScorecards", resp, "Failure sending request") - return - } - - result, err = client.GetLatencyScorecardsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetLatencyScorecards", resp, "Failure responding to request") - return - } - - return -} - -// GetLatencyScorecardsPreparer prepares the GetLatencyScorecards request. -func (client ReportsClient) GetLatencyScorecardsPreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string, aggregationInterval LatencyScorecardAggregationInterval, endDateTimeUTC string, country string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "experimentName": autorest.Encode("path", experimentName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "aggregationInterval": autorest.Encode("query", aggregationInterval), - "api-version": APIVersion, - } - if len(endDateTimeUTC) > 0 { - queryParameters["endDateTimeUTC"] = autorest.Encode("query", endDateTimeUTC) - } - if len(country) > 0 { - queryParameters["country"] = autorest.Encode("query", country) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/LatencyScorecard", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLatencyScorecardsSender sends the GetLatencyScorecards request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) GetLatencyScorecardsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLatencyScorecardsResponder handles the response to the GetLatencyScorecards request. The method always -// closes the http.Response Body. -func (client ReportsClient) GetLatencyScorecardsResponder(resp *http.Response) (result LatencyScorecard, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTimeseries sends the get timeseries request. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// profileName - the Profile identifier associated with the Tenant and Partner -// experimentName - the Experiment identifier associated with the Experiment -// startDateTimeUTC - the start DateTime of the Timeseries in UTC -// endDateTimeUTC - the end DateTime of the Timeseries in UTC -// aggregationInterval - the aggregation interval of the Timeseries -// timeseriesType - the type of Timeseries -// endpoint - the specific endpoint -// country - the country associated with the Timeseries. Values are country ISO codes as specified here- -// https://www.iso.org/iso-3166-country-codes.html -func (client ReportsClient) GetTimeseries(ctx context.Context, resourceGroupName string, profileName string, experimentName string, startDateTimeUTC date.Time, endDateTimeUTC date.Time, aggregationInterval TimeseriesAggregationInterval, timeseriesType TimeseriesType, endpoint string, country string) (result Timeseries, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.GetTimeseries") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: experimentName, - Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.ReportsClient", "GetTimeseries", err.Error()) - } - - req, err := client.GetTimeseriesPreparer(ctx, resourceGroupName, profileName, experimentName, startDateTimeUTC, endDateTimeUTC, aggregationInterval, timeseriesType, endpoint, country) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetTimeseries", nil, "Failure preparing request") - return - } - - resp, err := client.GetTimeseriesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetTimeseries", resp, "Failure sending request") - return - } - - result, err = client.GetTimeseriesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetTimeseries", resp, "Failure responding to request") - return - } - - return -} - -// GetTimeseriesPreparer prepares the GetTimeseries request. -func (client ReportsClient) GetTimeseriesPreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string, startDateTimeUTC date.Time, endDateTimeUTC date.Time, aggregationInterval TimeseriesAggregationInterval, timeseriesType TimeseriesType, endpoint string, country string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "experimentName": autorest.Encode("path", experimentName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "aggregationInterval": autorest.Encode("query", aggregationInterval), - "api-version": APIVersion, - "endDateTimeUTC": autorest.Encode("query", endDateTimeUTC), - "startDateTimeUTC": autorest.Encode("query", startDateTimeUTC), - "timeseriesType": autorest.Encode("query", timeseriesType), - } - if len(endpoint) > 0 { - queryParameters["endpoint"] = autorest.Encode("query", endpoint) - } - if len(country) > 0 { - queryParameters["country"] = autorest.Encode("query", country) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/Timeseries", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTimeseriesSender sends the GetTimeseries request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) GetTimeseriesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTimeseriesResponder handles the response to the GetTimeseries request. The method always -// closes the http.Response Body. -func (client ReportsClient) GetTimeseriesResponder(resp *http.Response) (result Timeseries, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/rulesengines.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/rulesengines.go deleted file mode 100644 index e2dfce931a63..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/rulesengines.go +++ /dev/null @@ -1,456 +0,0 @@ -package frontdoor - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RulesEnginesClient is the frontDoor Client -type RulesEnginesClient struct { - BaseClient -} - -// NewRulesEnginesClient creates an instance of the RulesEnginesClient client. -func NewRulesEnginesClient(subscriptionID string) RulesEnginesClient { - return NewRulesEnginesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRulesEnginesClientWithBaseURI creates an instance of the RulesEnginesClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewRulesEnginesClientWithBaseURI(baseURI string, subscriptionID string) RulesEnginesClient { - return RulesEnginesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Rules Engine Configuration with the specified name within the specified Front Door. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -// rulesEngineName - name of the Rules Engine which is unique within the Front Door. -// rulesEngineParameters - rules Engine Configuration properties needed to create a new Rules Engine -// Configuration. -func (client RulesEnginesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string, rulesEngineParameters RulesEngine) (result RulesEnginesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, - {TargetValue: rulesEngineName, - Constraints: []validation.Constraint{{Target: "rulesEngineName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "rulesEngineName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "rulesEngineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.RulesEnginesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, frontDoorName, rulesEngineName, rulesEngineParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RulesEnginesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string, rulesEngineParameters RulesEngine) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "rulesEngineName": autorest.Encode("path", rulesEngineName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - rulesEngineParameters.Name = nil - rulesEngineParameters.Type = nil - rulesEngineParameters.ID = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}", pathParameters), - autorest.WithJSON(rulesEngineParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RulesEnginesClient) CreateOrUpdateSender(req *http.Request) (future RulesEnginesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RulesEnginesClient) CreateOrUpdateResponder(resp *http.Response) (result RulesEngine, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing Rules Engine Configuration with the specified parameters. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -// rulesEngineName - name of the Rules Engine which is unique within the Front Door. -func (client RulesEnginesClient) Delete(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string) (result RulesEnginesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, - {TargetValue: rulesEngineName, - Constraints: []validation.Constraint{{Target: "rulesEngineName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "rulesEngineName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "rulesEngineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.RulesEnginesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, frontDoorName, rulesEngineName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RulesEnginesClient) DeletePreparer(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "rulesEngineName": autorest.Encode("path", rulesEngineName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RulesEnginesClient) DeleteSender(req *http.Request) (future RulesEnginesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RulesEnginesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a Rules Engine Configuration with the specified name within the specified Front Door. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -// rulesEngineName - name of the Rules Engine which is unique within the Front Door. -func (client RulesEnginesClient) Get(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string) (result RulesEngine, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, - {TargetValue: rulesEngineName, - Constraints: []validation.Constraint{{Target: "rulesEngineName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "rulesEngineName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "rulesEngineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.RulesEnginesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, frontDoorName, rulesEngineName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RulesEnginesClient) GetPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "rulesEngineName": autorest.Encode("path", rulesEngineName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RulesEnginesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RulesEnginesClient) GetResponder(resp *http.Response) (result RulesEngine, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByFrontDoor lists all of the Rules Engine Configurations within a Front Door. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// frontDoorName - name of the Front Door which is globally unique. -func (client RulesEnginesClient) ListByFrontDoor(ctx context.Context, resourceGroupName string, frontDoorName string) (result RulesEngineListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.ListByFrontDoor") - defer func() { - sc := -1 - if result.relr.Response.Response != nil { - sc = result.relr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, - {TargetValue: frontDoorName, - Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("frontdoor.RulesEnginesClient", "ListByFrontDoor", err.Error()) - } - - result.fn = client.listByFrontDoorNextResults - req, err := client.ListByFrontDoorPreparer(ctx, resourceGroupName, frontDoorName) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "ListByFrontDoor", nil, "Failure preparing request") - return - } - - resp, err := client.ListByFrontDoorSender(req) - if err != nil { - result.relr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "ListByFrontDoor", resp, "Failure sending request") - return - } - - result.relr, err = client.ListByFrontDoorResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "ListByFrontDoor", resp, "Failure responding to request") - return - } - if result.relr.hasNextLink() && result.relr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByFrontDoorPreparer prepares the ListByFrontDoor request. -func (client RulesEnginesClient) ListByFrontDoorPreparer(ctx context.Context, resourceGroupName string, frontDoorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "frontDoorName": autorest.Encode("path", frontDoorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByFrontDoorSender sends the ListByFrontDoor request. The method will close the -// http.Response Body if it receives an error. -func (client RulesEnginesClient) ListByFrontDoorSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByFrontDoorResponder handles the response to the ListByFrontDoor request. The method always -// closes the http.Response Body. -func (client RulesEnginesClient) ListByFrontDoorResponder(resp *http.Response) (result RulesEngineListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByFrontDoorNextResults retrieves the next set of results, if any. -func (client RulesEnginesClient) listByFrontDoorNextResults(ctx context.Context, lastResults RulesEngineListResult) (result RulesEngineListResult, err error) { - req, err := lastResults.rulesEngineListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "listByFrontDoorNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByFrontDoorSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "listByFrontDoorNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByFrontDoorResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "listByFrontDoorNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByFrontDoorComplete enumerates all values, automatically crossing page boundaries as required. -func (client RulesEnginesClient) ListByFrontDoorComplete(ctx context.Context, resourceGroupName string, frontDoorName string) (result RulesEngineListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.ListByFrontDoor") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByFrontDoor(ctx, resourceGroupName, frontDoorName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/version.go deleted file mode 100644 index 3a49dda71277..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package frontdoor - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " frontdoor/2020-11-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 4a42ef8f06d6..4910a2fb6733 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -3,7 +3,6 @@ github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb -github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security From ae6d1e86e1307339ccc53eb5c334c6b70cdd0024 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Fri, 31 Jan 2025 01:45:19 -0700 Subject: [PATCH 10/17] Fix lint error... from if else to switch case... --- .../cdn/cdn_frontdoor_firewall_policy_resource.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go index 46c85edbfa67..da27ab6f8da0 100644 --- a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go +++ b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go @@ -916,11 +916,14 @@ func expandCdnFrontDoorFirewallRuleOverride(input []interface{}, versionRaw stri // NOTE: Default Rule Sets(DRS) 2.0 and above rules only use action type of 'AnomalyScoring' or 'Log'. Issues 19088 and 19561 // This will still work for bot rules as well since it will be the default value of 1.0 - if version < 2.0 && action == waf.ActionTypeAnomalyScoring { + switch { + case version < 2.0 && action == waf.ActionTypeAnomalyScoring: return nil, fmt.Errorf("%q is only valid in managed rules 'type' is DRS 2.0 and above, got %q", waf.ActionTypeAnomalyScoring, versionRaw) - } else if version >= 2.0 && action != waf.ActionTypeAnomalyScoring && action != waf.ActionTypeLog { + + case version >= 2.0 && action != waf.ActionTypeAnomalyScoring && action != waf.ActionTypeLog: return nil, fmt.Errorf("the managed rules 'action' field must be set to 'AnomalyScoring' or 'Log' if the managed rule is DRS 2.0 or above, got %q", action) - } else if !strings.Contains(strings.ToLower(ruleType), "botmanagerruleset") && action == waf.ActionTypeJSChallenge { + + case !strings.Contains(strings.ToLower(ruleType), "botmanagerruleset") && action == waf.ActionTypeJSChallenge: return nil, fmt.Errorf("%q is only valid if the managed rules 'type' is 'Microsoft_BotManagerRuleSet', got %q", waf.ActionTypeJSChallenge, ruleType) } From 35fd9869bd248091f5ffc8af6a8ae326325b96fc Mon Sep 17 00:00:00 2001 From: Wodans Son <20408400+WodansSon@users.noreply.github.com> Date: Fri, 31 Jan 2025 22:37:46 -0700 Subject: [PATCH 11/17] Update internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go Co-authored-by: jackofallops <11830746+jackofallops@users.noreply.github.com> --- internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go index f4347958feda..ddb3a36c1fdc 100644 --- a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go +++ b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go @@ -932,7 +932,7 @@ func expandCdnFrontDoorFirewallRuleOverride(input []interface{}, versionRaw stri // This will still work for bot rules as well since it will be the default value of 1.0 switch { case version < 2.0 && action == waf.ActionTypeAnomalyScoring: - return nil, fmt.Errorf("%q is only valid in managed rules 'type' is DRS 2.0 and above, got %q", waf.ActionTypeAnomalyScoring, versionRaw) + return nil, fmt.Errorf("%q is only valid in managed rules where 'type' is DRS and `version` is '2.0' or above, got %q", waf.ActionTypeAnomalyScoring, versionRaw) case version >= 2.0 && action != waf.ActionTypeAnomalyScoring && action != waf.ActionTypeLog: return nil, fmt.Errorf("the managed rules 'action' field must be set to 'AnomalyScoring' or 'Log' if the managed rule is DRS 2.0 or above, got %q", action) From b978c740975587aff0733d0d6120b5d1ee48f472 Mon Sep 17 00:00:00 2001 From: Wodans Son <20408400+WodansSon@users.noreply.github.com> Date: Fri, 31 Jan 2025 22:38:09 -0700 Subject: [PATCH 12/17] Update internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go Co-authored-by: jackofallops <11830746+jackofallops@users.noreply.github.com> --- .../services/cdn/cdn_frontdoor_firewall_policy_resource_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go index 1bac7980c21a..72293d366f04 100644 --- a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go @@ -309,7 +309,6 @@ func TestAccCdnFrontDoorFirewallPolicy_DRSTwoPointOneActionError(t *testing.T) { }) } -// TODO: run these tests to make sure they work... func TestAccCdnFrontDoorFirewallPolicy_JSChallengeDRSError(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_firewall_policy", "test") r := CdnFrontDoorFirewallPolicyResource{} From b5ac63d2aa01c52bd945ad6b3f33e01b6293ed89 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Sun, 2 Feb 2025 00:04:26 -0700 Subject: [PATCH 13/17] Address PR comments... --- ...frontdoor_firewall_policy_resource_test.go | 6 +- .../cdn/cdn_frontdoor_rule_resource.go | 18 +- .../cdn/cdn_frontdoor_rule_resource_test.go | 9 +- .../cdn/cdn_frontdoor_rule_set_resource.go | 19 ++- .../cdn_frontdoor_rule_set_resource_test.go | 6 +- .../cdn/cdn_frontdoor_shared_schema.go | 2 +- internal/services/cdn/client/client.go | 2 +- .../cdn_frontdoor_rule_actions.go | 11 +- .../cdn_frontdoor_rule_conditions.go | 6 +- .../validate/front_door_validation_helpers.go | 2 +- .../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 -- .../rules/README.md | 6 +- .../rules/client.go | 0 .../rules/constants.go | 0 .../rules/id_rule.go | 0 .../rules/id_ruleset.go | 0 .../rules/method_create.go | 0 .../rules/method_delete.go | 0 .../rules/method_get.go | 0 .../rules/method_listbyruleset.go | 0 .../rules/method_update.go | 0 .../rules/model_cacheconfiguration.go | 0 .../model_cacheexpirationactionparameters.go | 0 ...del_cachekeyquerystringactionparameters.go | 0 ...odel_clientportmatchconditionparameters.go | 0 .../model_cookiesmatchconditionparameters.go | 0 .../rules/model_deliveryruleaction.go | 0 .../model_deliveryruleactionparameters.go | 0 ...model_deliveryrulecacheexpirationaction.go | 0 ...l_deliveryrulecachekeyquerystringaction.go | 0 .../model_deliveryruleclientportcondition.go | 0 .../rules/model_deliveryrulecondition.go | 0 .../model_deliveryruleconditionparameters.go | 0 .../model_deliveryrulecookiescondition.go | 0 .../model_deliveryrulehostnamecondition.go | 0 .../model_deliveryrulehttpversioncondition.go | 0 .../model_deliveryruleisdevicecondition.go | 0 .../model_deliveryrulepostargscondition.go | 0 .../model_deliveryrulequerystringcondition.go | 0 ...odel_deliveryruleremoteaddresscondition.go | 0 .../model_deliveryrulerequestbodycondition.go | 0 .../model_deliveryrulerequestheaderaction.go | 0 ...odel_deliveryrulerequestheadercondition.go | 0 ...odel_deliveryrulerequestmethodcondition.go | 0 ...odel_deliveryrulerequestschemecondition.go | 0 .../model_deliveryrulerequesturicondition.go | 0 .../model_deliveryruleresponseheaderaction.go | 0 ...eryrulerouteconfigurationoverrideaction.go | 0 .../model_deliveryruleserverportcondition.go | 0 .../model_deliveryrulesocketaddrcondition.go | 0 .../model_deliveryrulesslprotocolcondition.go | 0 ...l_deliveryruleurlfileextensioncondition.go | 0 .../model_deliveryruleurlfilenamecondition.go | 0 .../model_deliveryruleurlpathcondition.go | 0 .../rules/model_headeractionparameters.go | 0 .../model_hostnamematchconditionparameters.go | 0 ...del_httpversionmatchconditionparameters.go | 0 .../model_isdevicematchconditionparameters.go | 0 .../rules/model_origingroupoverride.go | 0 .../rules/model_origingroupoverrideaction.go | 0 ...del_origingroupoverrideactionparameters.go | 0 .../model_postargsmatchconditionparameters.go | 0 ...del_querystringmatchconditionparameters.go | 0 ...l_remoteaddressmatchconditionparameters.go | 0 ...del_requestbodymatchconditionparameters.go | 0 ...l_requestheadermatchconditionparameters.go | 0 ...l_requestmethodmatchconditionparameters.go | 0 ...l_requestschemematchconditionparameters.go | 0 ...odel_requesturimatchconditionparameters.go | 0 .../rules/model_resourcereference.go | 0 ...teconfigurationoverrideactionparameters.go | 0 .../rules/model_rule.go | 0 .../rules/model_ruleproperties.go | 0 .../rules/model_ruleupdateparameters.go | 0 .../model_ruleupdatepropertiesparameters.go | 0 ...odel_serverportmatchconditionparameters.go | 0 ...odel_socketaddrmatchconditionparameters.go | 0 ...del_sslprotocolmatchconditionparameters.go | 0 ...rlfileextensionmatchconditionparameters.go | 0 ...del_urlfilenamematchconditionparameters.go | 0 .../model_urlpathmatchconditionparameters.go | 0 .../rules/model_urlredirectaction.go | 0 .../model_urlredirectactionparameters.go | 0 .../rules/model_urlrewriteaction.go | 0 .../rules/model_urlrewriteactionparameters.go | 0 .../rules/model_urlsigningaction.go | 0 .../rules/model_urlsigningactionparameters.go | 0 .../rules/model_urlsigningparamidentifier.go | 0 .../rules/predicates.go | 0 .../rules/version.go | 4 +- vendor/modules.txt | 3 +- ...dn_frontdoor_firewall_policy.html.markdown | 2 +- 107 files changed, 45 insertions(+), 1097 deletions(-) delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/README.md delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/client.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/constants.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_endpoint.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_origin.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_create.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_delete.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_listbyendpoint.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_update.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_origin.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originproperties.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdateparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdatepropertiesparameters.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/predicates.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/version.go rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/README.md (96%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/client.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/constants.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/id_rule.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/id_ruleset.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/method_create.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/method_delete.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/method_get.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/method_listbyruleset.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/method_update.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_cacheconfiguration.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_cacheexpirationactionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_cachekeyquerystringactionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_clientportmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_cookiesmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleactionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulecacheexpirationaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulecachekeyquerystringaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleclientportcondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulecondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulecookiescondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulehostnamecondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulehttpversioncondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleisdevicecondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulepostargscondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulequerystringcondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleremoteaddresscondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulerequestbodycondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulerequestheaderaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulerequestheadercondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulerequestmethodcondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulerequestschemecondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulerequesturicondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleresponseheaderaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulerouteconfigurationoverrideaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleserverportcondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulesocketaddrcondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryrulesslprotocolcondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleurlfileextensioncondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleurlfilenamecondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_deliveryruleurlpathcondition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_headeractionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_hostnamematchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_httpversionmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_isdevicematchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_origingroupoverride.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_origingroupoverrideaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_origingroupoverrideactionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_postargsmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_querystringmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_remoteaddressmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_requestbodymatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_requestheadermatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_requestmethodmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_requestschemematchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_requesturimatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_resourcereference.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_routeconfigurationoverrideactionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_rule.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_ruleproperties.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_ruleupdateparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_ruleupdatepropertiesparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_serverportmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_socketaddrmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_sslprotocolmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlfileextensionmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlfilenamematchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlpathmatchconditionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlredirectaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlredirectactionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlrewriteaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlrewriteactionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlsigningaction.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlsigningactionparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/model_urlsigningparamidentifier.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/predicates.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/{2024-02-01 => 2024-09-01}/rules/version.go (69%) diff --git a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go index 72293d366f04..795d1f24bc01 100644 --- a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go @@ -10,7 +10,6 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" @@ -368,11 +367,8 @@ func (CdnFrontDoorFirewallPolicyResource) Exists(ctx context.Context, clients *c return nil, err } - resp, err := clients.Cdn.FrontDoorFirewallPoliciesClient.PoliciesGet(ctx, *id) + _, err = clients.Cdn.FrontDoorFirewallPoliciesClient.PoliciesGet(ctx, *id) if err != nil { - if response.WasNotFound(resp.HttpResponse) { - return pointer.To(false), nil - } return nil, fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource.go b/internal/services/cdn/cdn_frontdoor_rule_resource.go index 144bdbb44d9d..4a5d97b75788 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource.go @@ -5,12 +5,13 @@ package cdn import ( "fmt" + "log" "time" "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/go-azure-sdk/resource-manager/cdn/2024-09-01/rules" "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" @@ -681,21 +682,22 @@ func resourceCdnFrontDoorRuleRead(d *pluginsdk.ResourceData, meta interface{}) e result, err := client.Get(ctx, *id) if err != nil { if response.WasNotFound(result.HttpResponse) { + log.Printf("[DEBUG] %s was not found, removing from state", id) d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - if model := result.Model; model != nil { - if props := model.Properties; props != nil { - d.Set("name", id.RuleName) - d.Set("cdn_frontdoor_rule_set_id", ruleSet.ID()) + 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) + if model := result.Model; model != nil { + if props := model.Properties; props != nil { actions, err := flattenFrontdoorDeliveryRuleActions(props.Actions) if err != nil { return fmt.Errorf("setting 'actions': %+v", err) diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource_test.go b/internal/services/cdn/cdn_frontdoor_rule_resource_test.go index 2298a2eb32d6..c77783f6196e 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource_test.go @@ -9,8 +9,7 @@ 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/go-azure-sdk/resource-manager/cdn/2024-09-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" @@ -443,13 +442,11 @@ func (r CdnFrontDoorRuleResource) Exists(ctx context.Context, clients *clients.C } client := clients.Cdn.FrontDoorRulesClient - result, err := client.Get(ctx, *id) + _, err = client.Get(ctx, *id) if err != nil { - if response.WasNotFound(result.HttpResponse) { - return utils.Bool(false), nil - } return nil, fmt.Errorf("retrieving %s: %+v", id, err) } + return utils.Bool(true), nil } diff --git a/internal/services/cdn/cdn_frontdoor_rule_set_resource.go b/internal/services/cdn/cdn_frontdoor_rule_set_resource.go index 5443c39031ef..403f25080ad3 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_set_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_set_resource.go @@ -5,6 +5,7 @@ package cdn import ( "fmt" + "log" "time" "github.com/hashicorp/go-azure-helpers/lang/response" @@ -62,21 +63,20 @@ func resourceCdnFrontDoorRuleSetCreate(d *pluginsdk.ResourceData, meta interface return err } - // func NewRuleSetID(subscriptionId string, resourceGroupName string, profileName string, ruleSetName string) id := rulesets.NewRuleSetID(profile.SubscriptionId, profile.ResourceGroupName, profile.ProfileName, d.Get("name").(string)) - if d.IsNewResource() { - existing, err := client.Get(ctx, id) - if err != nil { - if !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for existing %s: %+v", id, err) - } - } + // if d.IsNewResource() { + existing, err := client.Get(ctx, id) + if err != nil { if !response.WasNotFound(existing.HttpResponse) { - return tf.ImportAsExistsError("azurerm_cdn_frontdoor_rule_set", id.ID()) + return fmt.Errorf("checking for existing %s: %+v", id, err) } } + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_cdn_frontdoor_rule_set", id.ID()) + } + // } if _, err = client.Create(ctx, id); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -98,6 +98,7 @@ func resourceCdnFrontDoorRuleSetRead(d *pluginsdk.ResourceData, meta interface{} resp, err := client.Get(ctx, *id) if err != nil { if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found, removing from state", id) d.SetId("") return nil } diff --git a/internal/services/cdn/cdn_frontdoor_rule_set_resource_test.go b/internal/services/cdn/cdn_frontdoor_rule_set_resource_test.go index 1fe45bc68ade..2be9c375384d 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_set_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_rule_set_resource_test.go @@ -8,7 +8,6 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rulesets" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" @@ -69,11 +68,8 @@ func (r CdnFrontDoorRuleSetResource) Exists(ctx context.Context, clients *client return nil, err } - resp, err := client.Get(ctx, *id) + _, err = client.Get(ctx, *id) if err != nil { - if response.WasNotFound(resp.HttpResponse) { - return utils.Bool(false), nil - } return nil, fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/cdn/cdn_frontdoor_shared_schema.go b/internal/services/cdn/cdn_frontdoor_shared_schema.go index 5656ffc8ce7a..3b7af1c222c1 100644 --- a/internal/services/cdn/cdn_frontdoor_shared_schema.go +++ b/internal/services/cdn/cdn_frontdoor_shared_schema.go @@ -4,7 +4,7 @@ package cdn import ( - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules" waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/cdn/client/client.go b/internal/services/cdn/client/client.go index 52c36e1cae2e..020da0e018f9 100644 --- a/internal/services/cdn/client/client.go +++ b/internal/services/cdn/client/client.go @@ -9,9 +9,9 @@ import ( cdnSdk "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" // nolint: staticcheck cdnFrontDoorSdk "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck "github.com/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" waf "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2024-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go b/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go index cfccbca48df8..41d5c826f0d9 100644 --- a/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go +++ b/internal/services/cdn/frontdoorruleactions/cdn_frontdoor_rule_actions.go @@ -8,8 +8,8 @@ import ( "strings" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "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/go-azure-sdk/resource-manager/cdn/2024-09-01/rules" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -432,9 +432,10 @@ func FlattenCdnFrontDoorRouteConfigurationOverrideAction(input rules.DeliveryRul if override := params.OriginGroupOverride; override != nil { forwardingProtocol = string(pointer.From(override.ForwardingProtocol)) - // 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) + // NOTE: Need to parse this ID insensitively to normalize it because if you modified this + // resource in the Azure Portal the 'resourceGroup' element comes back as 'resourcegroup' + // not 'resourceGroup'. + originGroup, err := parse.FrontDoorOriginGroupIDInsensitively(*override.OriginGroup.Id) if err != nil { return nil, err } diff --git a/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go b/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go index 55e59fc69fad..11aaf4ede125 100644 --- a/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go +++ b/internal/services/cdn/frontdoorruleconditions/cdn_frontdoor_rule_conditions.go @@ -7,7 +7,7 @@ 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/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules" helperValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -232,7 +232,9 @@ func validateCdnFrontDoorExpandConditionOperatorValues(operator string, matchVal return fmt.Errorf("%q is invalid: no 'operator' value has been set, got %q", m.ConfigName, operator) } - // 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... + // NOTE: There are now 14 different 'Any' operators in the new API, however they are all the same value so I am just hardcoding the value evaluation here, + // the multiple values appears to be by design as they have exposed an "Any" field for each condition type (e.g., 'ClientPortOperatorAny', + // 'CookiesOperatorAny', 'HostNameOperatorAny', etc.) due to the swagger issue raised by TomBuildsStuff... 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) } diff --git a/internal/services/cdn/validate/front_door_validation_helpers.go b/internal/services/cdn/validate/front_door_validation_helpers.go index f05d7d1b4954..1ee1fac6d7e3 100644 --- a/internal/services/cdn/validate/front_door_validation_helpers.go +++ b/internal/services/cdn/validate/front_door_validation_helpers.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" + "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" ) 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 deleted file mode 100644 index 7457f0c448a0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `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 deleted file mode 100644 index ce3ee970663d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100644 index a04f9ed83bfb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/constants.go +++ /dev/null @@ -1,154 +0,0 @@ -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 deleted file mode 100644 index 1949f9dde152..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_endpoint.go +++ /dev/null @@ -1,139 +0,0 @@ -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 deleted file mode 100644 index fcdddcb853d3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/id_origin.go +++ /dev/null @@ -1,148 +0,0 @@ -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 deleted file mode 100644 index e6005a205a42..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_create.go +++ /dev/null @@ -1,76 +0,0 @@ -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 deleted file mode 100644 index 47d36e6e87f5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -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 deleted file mode 100644 index a7594c26290f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_get.go +++ /dev/null @@ -1,53 +0,0 @@ -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 deleted file mode 100644 index 476f311d7bbe..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_listbyendpoint.go +++ /dev/null @@ -1,105 +0,0 @@ -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 deleted file mode 100644 index 830da0e27ffe..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/method_update.go +++ /dev/null @@ -1,75 +0,0 @@ -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 deleted file mode 100644 index 38f21bdbd290..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_origin.go +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index 1c6a60f33a7b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originproperties.go +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 7277698e9d5b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdateparameters.go +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index c442bb8d4d93..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/model_originupdatepropertiesparameters.go +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 2424013ceb9a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/predicates.go +++ /dev/null @@ -1,27 +0,0 @@ -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 deleted file mode 100644 index 615b7e14a8ef..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/origins/version.go +++ /dev/null @@ -1,10 +0,0 @@ -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-09-01/rules/README.md similarity index 96% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/README.md index 9804b1c05f30..c3ceffd5f8d8 100644 --- 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-09-01/rules/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules` Documentation -The `rules` SDK allows for interaction with Azure Resource Manager `cdn` (API Version `2024-02-01`). +The `rules` SDK allows for interaction with Azure Resource Manager `cdn` (API Version `2024-09-01`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). ### Import Path ```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules" +import "github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules" ``` 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-09-01/rules/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/client.go 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-09-01/rules/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/constants.go 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-09-01/rules/id_rule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/id_rule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_rule.go 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-09-01/rules/id_ruleset.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/id_ruleset.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/id_ruleset.go 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-09-01/rules/method_create.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_create.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_create.go 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-09-01/rules/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_delete.go 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-09-01/rules/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_get.go 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-09-01/rules/method_listbyruleset.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_listbyruleset.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_listbyruleset.go 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-09-01/rules/method_update.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/method_update.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/method_update.go 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-09-01/rules/model_cacheconfiguration.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_cacheconfiguration.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheconfiguration.go 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-09-01/rules/model_cacheexpirationactionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_cacheexpirationactionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cacheexpirationactionparameters.go 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-09-01/rules/model_cachekeyquerystringactionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_cachekeyquerystringactionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cachekeyquerystringactionparameters.go 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-09-01/rules/model_clientportmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_clientportmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_clientportmatchconditionparameters.go 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-09-01/rules/model_cookiesmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_cookiesmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_cookiesmatchconditionparameters.go 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-09-01/rules/model_deliveryruleaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleaction.go 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-09-01/rules/model_deliveryruleactionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleactionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleactionparameters.go 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-09-01/rules/model_deliveryrulecacheexpirationaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulecacheexpirationaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecacheexpirationaction.go 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-09-01/rules/model_deliveryrulecachekeyquerystringaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulecachekeyquerystringaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecachekeyquerystringaction.go 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-09-01/rules/model_deliveryruleclientportcondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleclientportcondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleclientportcondition.go 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-09-01/rules/model_deliveryrulecondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulecondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecondition.go 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-09-01/rules/model_deliveryruleconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleconditionparameters.go 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-09-01/rules/model_deliveryrulecookiescondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulecookiescondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulecookiescondition.go 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-09-01/rules/model_deliveryrulehostnamecondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulehostnamecondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehostnamecondition.go 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-09-01/rules/model_deliveryrulehttpversioncondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulehttpversioncondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulehttpversioncondition.go 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-09-01/rules/model_deliveryruleisdevicecondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleisdevicecondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleisdevicecondition.go 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-09-01/rules/model_deliveryrulepostargscondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulepostargscondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulepostargscondition.go 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-09-01/rules/model_deliveryrulequerystringcondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulequerystringcondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulequerystringcondition.go 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-09-01/rules/model_deliveryruleremoteaddresscondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleremoteaddresscondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleremoteaddresscondition.go 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-09-01/rules/model_deliveryrulerequestbodycondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestbodycondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestbodycondition.go 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-09-01/rules/model_deliveryrulerequestheaderaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestheaderaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheaderaction.go 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-09-01/rules/model_deliveryrulerequestheadercondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestheadercondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestheadercondition.go 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-09-01/rules/model_deliveryrulerequestmethodcondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestmethodcondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestmethodcondition.go 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-09-01/rules/model_deliveryrulerequestschemecondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequestschemecondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequestschemecondition.go 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-09-01/rules/model_deliveryrulerequesturicondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerequesturicondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerequesturicondition.go 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-09-01/rules/model_deliveryruleresponseheaderaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleresponseheaderaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleresponseheaderaction.go 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-09-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulerouteconfigurationoverrideaction.go 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-09-01/rules/model_deliveryruleserverportcondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleserverportcondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleserverportcondition.go 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-09-01/rules/model_deliveryrulesocketaddrcondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulesocketaddrcondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesocketaddrcondition.go 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-09-01/rules/model_deliveryrulesslprotocolcondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryrulesslprotocolcondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryrulesslprotocolcondition.go 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-09-01/rules/model_deliveryruleurlfileextensioncondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleurlfileextensioncondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfileextensioncondition.go 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-09-01/rules/model_deliveryruleurlfilenamecondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleurlfilenamecondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlfilenamecondition.go 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-09-01/rules/model_deliveryruleurlpathcondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_deliveryruleurlpathcondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_deliveryruleurlpathcondition.go 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-09-01/rules/model_headeractionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_headeractionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_headeractionparameters.go 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-09-01/rules/model_hostnamematchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_hostnamematchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_hostnamematchconditionparameters.go 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-09-01/rules/model_httpversionmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_httpversionmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_httpversionmatchconditionparameters.go 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-09-01/rules/model_isdevicematchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_isdevicematchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_isdevicematchconditionparameters.go 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-09-01/rules/model_origingroupoverride.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_origingroupoverride.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverride.go 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-09-01/rules/model_origingroupoverrideaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_origingroupoverrideaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideaction.go 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-09-01/rules/model_origingroupoverrideactionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_origingroupoverrideactionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_origingroupoverrideactionparameters.go 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-09-01/rules/model_postargsmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_postargsmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_postargsmatchconditionparameters.go 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-09-01/rules/model_querystringmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_querystringmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_querystringmatchconditionparameters.go 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-09-01/rules/model_remoteaddressmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_remoteaddressmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_remoteaddressmatchconditionparameters.go 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-09-01/rules/model_requestbodymatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requestbodymatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestbodymatchconditionparameters.go 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-09-01/rules/model_requestheadermatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requestheadermatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestheadermatchconditionparameters.go 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-09-01/rules/model_requestmethodmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requestmethodmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestmethodmatchconditionparameters.go 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-09-01/rules/model_requestschemematchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requestschemematchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requestschemematchconditionparameters.go 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-09-01/rules/model_requesturimatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_requesturimatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_requesturimatchconditionparameters.go 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-09-01/rules/model_resourcereference.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_resourcereference.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_resourcereference.go 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-09-01/rules/model_routeconfigurationoverrideactionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_routeconfigurationoverrideactionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_routeconfigurationoverrideactionparameters.go 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-09-01/rules/model_rule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_rule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_rule.go 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-09-01/rules/model_ruleproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_ruleproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleproperties.go 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-09-01/rules/model_ruleupdateparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_ruleupdateparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdateparameters.go 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-09-01/rules/model_ruleupdatepropertiesparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_ruleupdatepropertiesparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_ruleupdatepropertiesparameters.go 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-09-01/rules/model_serverportmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_serverportmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_serverportmatchconditionparameters.go 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-09-01/rules/model_socketaddrmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_socketaddrmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_socketaddrmatchconditionparameters.go 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-09-01/rules/model_sslprotocolmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_sslprotocolmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_sslprotocolmatchconditionparameters.go 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-09-01/rules/model_urlfileextensionmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlfileextensionmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfileextensionmatchconditionparameters.go 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-09-01/rules/model_urlfilenamematchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlfilenamematchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlfilenamematchconditionparameters.go 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-09-01/rules/model_urlpathmatchconditionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlpathmatchconditionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlpathmatchconditionparameters.go 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-09-01/rules/model_urlredirectaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlredirectaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectaction.go 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-09-01/rules/model_urlredirectactionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlredirectactionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlredirectactionparameters.go 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-09-01/rules/model_urlrewriteaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlrewriteaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteaction.go 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-09-01/rules/model_urlrewriteactionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlrewriteactionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlrewriteactionparameters.go 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-09-01/rules/model_urlsigningaction.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlsigningaction.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningaction.go 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-09-01/rules/model_urlsigningactionparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlsigningactionparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningactionparameters.go 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-09-01/rules/model_urlsigningparamidentifier.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/model_urlsigningparamidentifier.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/model_urlsigningparamidentifier.go 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-09-01/rules/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/predicates.go 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-09-01/rules/version.go similarity index 69% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-02-01/rules/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cdn/2024-09-01/rules/version.go index 5f6afc46572a..92f94359d2cf 100644 --- 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-09-01/rules/version.go @@ -3,8 +3,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. -const defaultApiVersion = "2024-02-01" +const defaultApiVersion = "2024-09-01" func userAgent() string { - return "hashicorp/go-azure-sdk/rules/2024-02-01" + return "hashicorp/go-azure-sdk/rules/2024-09-01" } diff --git a/vendor/modules.txt b/vendor/modules.txt index 33f628666f4b..e1229bc47de4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -309,11 +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/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 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 github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes diff --git a/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown b/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown index dff26dd40d99..0d1c691bdb7d 100644 --- a/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown +++ b/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown @@ -143,7 +143,7 @@ The following arguments are supported: * `js_challenge_cookie_expiration_in_minutes` - (Optional) Specifies the JavaScript challenge cookie lifetime in minutes, after which the user will be revalidated. Possible values are between `5` to `1440` minutes. Defaults to `30` minutes. -!> **Important:** Azure Web Application Firewall JavaScript challenge is currently in **PREVIEW**. See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. +!> **Note:** Azure Web Application Firewall JavaScript challenge is currently in **PREVIEW**. See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. * `mode` - (Required) The Front Door Firewall Policy mode. Possible values are `Detection`, `Prevention`. From 5311de0765e0495b07ef5796395272c1964a5ceb Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Sun, 2 Feb 2025 02:22:29 -0700 Subject: [PATCH 14/17] Fix test case due to new returned error value... --- .../services/cdn/cdn_frontdoor_firewall_policy_resource_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go index 795d1f24bc01..91c8cf34f405 100644 --- a/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_firewall_policy_resource_test.go @@ -196,7 +196,7 @@ func TestAccCdnFrontDoorFirewallPolicy_DRSOnePointOhError(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.DRSOnePointOhError(data), - ExpectError: regexp.MustCompile("'AnomalyScoring' is only valid in managed rules that are DRS 2.0 and above"), + ExpectError: regexp.MustCompile(`"AnomalyScoring" is only valid in managed rules where 'type' is DRS`), }, }) } From b157772d31a78bc049323ccaf7708e80db216d66 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:52:11 -0700 Subject: [PATCH 15/17] Set Behavior and Order in Read... --- internal/services/cdn/cdn_frontdoor_rule_resource.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource.go b/internal/services/cdn/cdn_frontdoor_rule_resource.go index 4a5d97b75788..de044a313173 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource.go @@ -698,6 +698,9 @@ func resourceCdnFrontDoorRuleRead(d *pluginsdk.ResourceData, meta interface{}) e if model := result.Model; model != nil { if props := model.Properties; props != nil { + d.Set("behavior_on_match", props.MatchProcessingBehavior) + d.Set("order", props.Order) + actions, err := flattenFrontdoorDeliveryRuleActions(props.Actions) if err != nil { return fmt.Errorf("setting 'actions': %+v", err) From c3936ae63aa63dc276e9ae3c609e5da3c508c06c Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Sun, 2 Feb 2025 17:54:08 -0700 Subject: [PATCH 16/17] Fix lint error add example of override for jschallenge... --- .../cdn/cdn_frontdoor_rule_resource.go | 2 +- ...dn_frontdoor_firewall_policy.html.markdown | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/internal/services/cdn/cdn_frontdoor_rule_resource.go b/internal/services/cdn/cdn_frontdoor_rule_resource.go index de044a313173..c9feead4b17e 100644 --- a/internal/services/cdn/cdn_frontdoor_rule_resource.go +++ b/internal/services/cdn/cdn_frontdoor_rule_resource.go @@ -698,7 +698,7 @@ func resourceCdnFrontDoorRuleRead(d *pluginsdk.ResourceData, meta interface{}) e if model := result.Model; model != nil { if props := model.Properties; props != nil { - d.Set("behavior_on_match", props.MatchProcessingBehavior) + d.Set("behavior_on_match", string(*props.MatchProcessingBehavior)) d.Set("order", props.Order) actions, err := flattenFrontdoorDeliveryRuleActions(props.Actions) diff --git a/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown b/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown index 0d1c691bdb7d..bae0775ddc8e 100644 --- a/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown +++ b/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown @@ -127,6 +127,26 @@ resource "azurerm_cdn_frontdoor_firewall_policy" "example" { } ``` +## Example Usage: JSChallenge Override + +```hcl +managed_rule { + type = "Microsoft_BotManagerRuleSet" + version = "1.1" + action = "Log" + + override { + rule_group_name = "BadBots" + + rule { + action = "JSChallenge" + enabled = true + rule_id = "Bot100200" + } + } +} +``` + ## Argument Reference The following arguments are supported: From 2ed8d903e6240872fa1344408e03e8b913d14c72 Mon Sep 17 00:00:00 2001 From: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> Date: Mon, 3 Feb 2025 00:36:08 -0700 Subject: [PATCH 17/17] Add legal note for JSChallenge value for action field... --- .../docs/r/cdn_frontdoor_firewall_policy.html.markdown | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown b/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown index bae0775ddc8e..d4e940c1270c 100644 --- a/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown +++ b/website/docs/r/cdn_frontdoor_firewall_policy.html.markdown @@ -163,7 +163,7 @@ The following arguments are supported: * `js_challenge_cookie_expiration_in_minutes` - (Optional) Specifies the JavaScript challenge cookie lifetime in minutes, after which the user will be revalidated. Possible values are between `5` to `1440` minutes. Defaults to `30` minutes. -!> **Note:** Azure Web Application Firewall JavaScript challenge is currently in **PREVIEW**. See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. +!> **Note:** Azure Web Application Firewall JavaScript challenge is currently in **PREVIEW**. Please see the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. * `mode` - (Required) The Front Door Firewall Policy mode. Possible values are `Detection`, `Prevention`. @@ -225,9 +225,9 @@ A `managed_rule` block supports the following: * `type` - (Required) The name of the managed rule to use with this resource. Possible values include `DefaultRuleSet`, `Microsoft_DefaultRuleSet`, `BotProtection` or `Microsoft_BotManagerRuleSet`. -* `version` - (Required) The version of the managed rule to use with this resource. Possible values depends on which rule set type you are using, for the `DefaultRuleSet` type the possible values include `1.0` or `preview-0.1`. For `Microsoft_DefaultRuleSet` the possible values include `1.1`, `2.0` or `2.1`. For `BotProtection` the value must be `preview-0.1` and for `Microsoft_BotManagerRuleSet` the possible values include `1.0` and `1.1`. +* `version` - (Required) The version of the managed rule to use with this resource. Possible values depends on which default rule set type you are using, for the `DefaultRuleSet` type the possible values include `1.0` or `preview-0.1`. For `Microsoft_DefaultRuleSet` the possible values include `1.1`, `2.0` or `2.1`. For `BotProtection` the value must be `preview-0.1` and for `Microsoft_BotManagerRuleSet` the possible values include `1.0` and `1.1`. -* `action` - (Required) The action to perform for all rule set rules when the managed rule is matched or when the anomaly score is 5 or greater depending on which version of the rule set you are using. Possible values include `Allow`, `Log`, `Block`, and `Redirect`. +* `action` - (Required) The action to perform for all default rule set rules when the managed rule is matched or when the anomaly score is 5 or greater depending on which version of the default rule set you are using. Possible values include `Allow`, `Log`, `Block`, and `Redirect`. * `exclusion` - (Optional) One or more `exclusion` blocks as defined below. @@ -251,7 +251,9 @@ A `rule` block supports the following: * `action` - (Required) The action to be applied when the managed rule matches or when the anomaly score is 5 or greater. Possible values for `DefaultRuleSet 1.1` and below are `Allow`, `Log`, `Block`, or `Redirect`. Possible values for `DefaultRuleSet 2.0` and above are `Log` or `AnomalyScoring`. Possible values for `Microsoft_BotManagerRuleSet` are `Allow`, `Log`, `Block`, `Redirect` or `JSChallenge`. -->**Note:** Please see the `DefaultRuleSet` [product documentation](https://learn.microsoft.com/azure/web-application-firewall/afds/waf-front-door-drs?tabs=drs20#anomaly-scoring-mode) or the `Microsoft_BotManagerRuleSet` [product documentation](https://learn.microsoft.com/azure/web-application-firewall/afds/afds-overview) for more information. +-> **Note:** Please see the `DefaultRuleSet` [product documentation](https://learn.microsoft.com/azure/web-application-firewall/afds/waf-front-door-drs?tabs=drs20#anomaly-scoring-mode) or the `Microsoft_BotManagerRuleSet` [product documentation](https://learn.microsoft.com/azure/web-application-firewall/afds/afds-overview) for more information. + +!> **Note:** The `action` field value `JSChallenge` is currently in **PREVIEW**. Please see the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. * `enabled` - (Optional) Is the managed rule override enabled or disabled. Defaults to `false`