Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDN Endpoint Delivery Rules #6163

Merged
merged 100 commits into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
4217465
bump CDN api version
r0bnet Mar 1, 2020
50f3a5d
add delivery policy rule name validation function
r0bnet Mar 1, 2020
f6ad207
add endpoint delivery policy, rule, request schema condition and url …
r0bnet Mar 1, 2020
90f2f4e
allow max 5 rules per delivery policy
r0bnet Mar 1, 2020
ca528fa
rename delivery_rule to rule; allow max 4 rules (leave one spot for g…
r0bnet Mar 1, 2020
2806d1e
implement rad & update for delivery_policy
r0bnet Mar 1, 2020
a3651be
Merge branch 'master' into cdn-endpoint-delivery-rules
r0bnet Mar 2, 2020
e26f039
move actions and condition into own dir; add flatten functions for ur…
r0bnet Mar 8, 2020
81ae83b
fix basic issues in order to run `terraform plan`
r0bnet Mar 8, 2020
f4cb920
Merge branch 'master' into cdn-endpoint-delivery-rules
r0bnet Mar 8, 2020
97e2267
fix problems in order to apply correctly
r0bnet Mar 8, 2020
bff24d2
fix rename of match_values to match_value; rename endpoint_delivery_p…
r0bnet Mar 8, 2020
a87c141
add method to test cache expiration duration
r0bnet Mar 8, 2020
f4aab97
shorten names of conditions and actions
r0bnet Mar 8, 2020
9fe50e7
add cache expiration action
r0bnet Mar 8, 2020
1082b3c
add cache expiration action to delivery_rule
r0bnet Mar 8, 2020
dd4b132
fix not working build
r0bnet Mar 8, 2020
da8e280
disable adding of duration when using BypassCache behavior
r0bnet Mar 8, 2020
c2349ed
remove obsolete policy layer; make removing of rules working as well
r0bnet Mar 9, 2020
bb9580c
Updated virtual_hub.html.markdown (#6033)
antigithubcrap Mar 9, 2020
dd60c15
wip: adding a scaffolder for resources/data sources
tombuildsstuff Feb 20, 2020
0476806
New Tool: website-scaffolder
tombuildsstuff Feb 24, 2020
9a7b519
d|r/resource_group: generating updated documentation
tombuildsstuff Feb 24, 2020
6ca5c8d
tooling: adding the scaffold-website tool to the makefile
tombuildsstuff Feb 24, 2020
9b4f07c
r/search_service: updating the docs
tombuildsstuff Feb 24, 2020
d431202
tools: fixing an issue when scaffolding the example for a data source
tombuildsstuff Feb 28, 2020
0861b1c
linting
tombuildsstuff Feb 28, 2020
2c6f327
tools/website-scaffold: fixing a typo
tombuildsstuff Feb 28, 2020
e3f683f
r/search_service: the fields `partition_count` and `replica_count` ar…
tombuildsstuff Mar 9, 2020
8a5377b
tests: clarifying the features block is required going forward
tombuildsstuff Mar 9, 2020
5f27bdc
features: removing the unused "two point oh" feature
tombuildsstuff Mar 9, 2020
d72fe54
tidying
tombuildsstuff Mar 9, 2020
d1aaa51
`azurerm_sql_server` - support for the `extended_auditing_polic… (#5036)
yupwei68 Mar 9, 2020
a2cba86
Update CHANGELOG.md to include #5036
katbyte Mar 9, 2020
d9d3558
azurerm_network_watcher_flow_log - support for the`interval_in… (#5851)
magodo Mar 9, 2020
321a4fb
Update CHANGELOG.md to include #5851
katbyte Mar 9, 2020
c63b569
bump CDN api version
r0bnet Mar 1, 2020
6208d24
add delivery policy rule name validation function
r0bnet Mar 1, 2020
ebb683a
add endpoint delivery policy, rule, request schema condition and url …
r0bnet Mar 1, 2020
1354fcf
allow max 5 rules per delivery policy
r0bnet Mar 1, 2020
13f3e95
rename delivery_rule to rule; allow max 4 rules (leave one spot for g…
r0bnet Mar 1, 2020
d344af3
implement rad & update for delivery_policy
r0bnet Mar 1, 2020
dedd4c7
move actions and condition into own dir; add flatten functions for ur…
r0bnet Mar 8, 2020
3c46538
fix basic issues in order to run `terraform plan`
r0bnet Mar 8, 2020
1543dc9
fix problems in order to apply correctly
r0bnet Mar 8, 2020
ca3b6fb
fix rename of match_values to match_value; rename endpoint_delivery_p…
r0bnet Mar 8, 2020
f5c7d1f
add method to test cache expiration duration
r0bnet Mar 8, 2020
8bea9b0
shorten names of conditions and actions
r0bnet Mar 8, 2020
8660b2c
add cache expiration action
r0bnet Mar 8, 2020
1a0ab9f
add cache expiration action to delivery_rule
r0bnet Mar 8, 2020
9fce0fc
fix not working build
r0bnet Mar 8, 2020
808ee7c
disable adding of duration when using BypassCache behavior
r0bnet Mar 8, 2020
91a7763
remove obsolete policy layer; make removing of rules working as well
r0bnet Mar 9, 2020
75a23dd
rename packages without underscores
r0bnet Mar 11, 2020
7ffd32e
add cache key query string action
r0bnet Mar 11, 2020
a0ce1b3
Merge remote-tracking branch 'fork/cdn-endpoint-delivery-rules' into …
r0bnet Mar 11, 2020
fe21aa5
remove obsolete files
r0bnet Mar 11, 2020
000bd25
add modify request header action
r0bnet Mar 11, 2020
1820029
add modify response header action
r0bnet Mar 11, 2020
3cf2cec
extract delivery rule actions and conditions into own function
r0bnet Mar 11, 2020
dd5e681
add URL Rewrite action
r0bnet Mar 12, 2020
8f91a96
Merge branch 'master' into cdn-endpoint-delivery-rules
r0bnet Mar 14, 2020
d0989bf
refactor/shorten ExpandArmCdnEndpointConditionRequestScheme function
r0bnet Mar 15, 2020
7b77d6b
add cookies condition
r0bnet Mar 15, 2020
4371be8
add HTTP version condition
r0bnet Mar 15, 2020
ff613b4
allow multiple values for cookies condition
r0bnet Mar 15, 2020
ff83fb5
allow multiple values for request scheme
r0bnet Mar 15, 2020
fc43917
add device condition
r0bnet Mar 15, 2020
6a3798d
allow transforms to be a list instead of single value
r0bnet Mar 15, 2020
8e07d56
add post arg condition
r0bnet Mar 16, 2020
b68da86
convert operator to string
r0bnet Mar 16, 2020
6374f98
add query string condition
r0bnet Mar 16, 2020
c0ace33
add remote address condition
r0bnet Mar 16, 2020
a978dcc
add request body condition
r0bnet Mar 16, 2020
5d5cbbd
add request header condition
r0bnet Mar 17, 2020
50c2c08
add request method condition
r0bnet Mar 17, 2020
683899b
add request uri condition
r0bnet Mar 17, 2020
5fbfcea
add url file extension condition
r0bnet Mar 17, 2020
af905f9
add url file name condition
r0bnet Mar 17, 2020
4ba4409
ad url path condition
r0bnet Mar 17, 2020
8ad070e
Merge branch 'master' into cdn-endpoint-delivery-rules
r0bnet Mar 17, 2020
2f629eb
add global delivery rule
r0bnet Mar 17, 2020
ab89626
add documentation for delivery rule and global delivery rule; fix min…
r0bnet Mar 18, 2020
ea4f77f
adjust documentation
r0bnet Mar 18, 2020
4ba005f
prevent user from using delivery_rule oder global_delivery_rule in co…
r0bnet Mar 18, 2020
1a28090
fix profile sku naming in error message
r0bnet Mar 18, 2020
b5fd573
add test for global_delivery_rule
r0bnet Mar 18, 2020
e989463
add test for delivery_rule
r0bnet Mar 18, 2020
8bff413
Merge branch 'master' into cdn-endpoint-delivery-rules
r0bnet Mar 18, 2020
6007326
fix linter problems
r0bnet Mar 18, 2020
65d11d6
fix tflinter problems
r0bnet Mar 18, 2020
681b1b9
Merge branch 'master' into cdn-endpoint-delivery-rules
r0bnet Mar 19, 2020
1e2756e
cdn: removing the profile
tombuildsstuff Apr 14, 2020
e8a2016
r/cdn_endpoint: reusing the same ctx
tombuildsstuff Apr 15, 2020
80194a9
refactoring from PR / ensuring fields are always set
tombuildsstuff Apr 15, 2020
dac90af
r/cdn_endpoint: ensuring the nested blocks are always set
tombuildsstuff Apr 15, 2020
759f199
r/cdn_endpoint: making the schema internal
tombuildsstuff Apr 15, 2020
4a7d1ce
r/cdn_endpoint: fixing up the docs
tombuildsstuff Apr 15, 2020
07d5cb7
Merge branch 'master' into cdn-endpoint-delivery-rules
tombuildsstuff Apr 15, 2020
94a8759
fix lintrest problems
r0bnet Apr 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions azurerm/helpers/validate/cdn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package validate

import (
"fmt"
"regexp"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)

func EndpointDeliveryRuleName() schema.SchemaValidateFunc {
return validation.StringMatch(
regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9]*$"),
"The Delivery Rule Name must start with a letter any may only contain letters and numbers.",
tombuildsstuff marked this conversation as resolved.
Show resolved Hide resolved
)
}

func RuleActionCacheExpirationDuration() schema.SchemaValidateFunc {
return validation.StringMatch(
regexp.MustCompile(`^(\d+\.)?([0-1][0-9]|[2][0-3]):[0-5][0-9]:[0-5][0-9]$`),
"The Cache duration must be in this format [d.]hh:mm:ss.",
)
}

func RuleActionUrlRedirectPath() schema.SchemaValidateFunc {
return validation.StringMatch(
regexp.MustCompile("^(/.*)?$"),
"The Url Redirect Path must start with a slash.",
)
}

func RuleActionUrlRedirectQueryString() schema.SchemaValidateFunc {
return func(i interface{}, s string) ([]string, []error) {
querystring := i.(string)

if len(querystring) > 100 {
return nil, []error{fmt.Errorf("The Url Query String's max length is 100.")}
}

re, _ := regexp.Compile("^[?&]")
if re.MatchString(querystring) {
return nil, []error{fmt.Errorf("The Url Query String must not start with a question mark or ampersand.")}
}

kvre, _ := regexp.Compile("^[^?&]+=[^?&]+$")
kvs := strings.Split(querystring, "&")
for _, kv := range kvs {
if len(kv) > 0 && !kvre.MatchString(kv) {
return nil, []error{fmt.Errorf("The Url Query String must be in <key>=<value> format and separated by an ampersand.")}
}
}

return nil, nil
}
}

func RuleActionUrlRedirectFragment() schema.SchemaValidateFunc {
return validation.StringMatch(
regexp.MustCompile("^([^#].*)?$"),
"The Url Fragment must not start with a hash.",
)
}

func RuleActionUrlRewriteSourcePattern() schema.SchemaValidateFunc {
return validation.StringMatch(
regexp.MustCompile("^/[^\n]{0,259}$"),
"The Url Rewrite Source Pattern must start with a slash and can not have more than 260 characters.",
)
}

func RuleActionUrlRewriteDestination() schema.SchemaValidateFunc {
return validation.StringMatch(
regexp.MustCompile("^/[^\n]{0,259}$"),
"The Url Rewrite Destination must start with a slash and can not have more than 260 characters.",
)
}
Loading