-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
azurerm_dns_zone & azurerm_private_dns_zone - support for the `soa_re…
…cord` block (#9319) API doc for DNS SOA Record: docs.microsoft.com/en-us/rest/api/dns/recordsets/createorupdate#soarecord API doc for Private DNS SOA Record: docs.microsoft.com/en-us/rest/api/dns/privatedns/recordsets/createorupdate#soarecord DNS SOA Record and Private DNS SOA Record cannot be made as separate resource because they aren't allowed to be created and deleted by API. So they have to be embedded into dns zone resource and private dns zone resource. See more details from below links: docs.microsoft.com/en-us/rest/api/dns/privatedns/recordsets/delete#recordtype docs.microsoft.com/en-us/rest/api/dns/privatedns/recordsets/createorupdate#recordtype docs.microsoft.com/en-us/rest/api/dns/recordsets/createorupdate#recordtype docs.microsoft.com/en-us/rest/api/dns/recordsets/delete#recordtype
- Loading branch information
Neil Ye
authored
Nov 19, 2020
1 parent
3edbbc1
commit a0155e2
Showing
10 changed files
with
829 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package validate | ||
|
||
import ( | ||
"fmt" | ||
"regexp" | ||
"strings" | ||
) | ||
|
||
func DnsZoneSOARecordEmail(v interface{}, k string) (warnings []string, errors []error) { | ||
value := v.(string) | ||
|
||
if len(value) == 0 { | ||
errors = append(errors, fmt.Errorf("%q cannot be an empty string: %q", k, v)) | ||
return warnings, errors | ||
} | ||
|
||
vSegments := strings.Split(value, ".") | ||
if len(vSegments) < 2 || len(vSegments) > 34 { | ||
errors = append(errors, fmt.Errorf("%q must be between 2 and 34 segments", k)) | ||
return warnings, errors | ||
} | ||
|
||
for _, segment := range vSegments { | ||
if segment == "" { | ||
errors = append(errors, fmt.Errorf("%q cannot contain consecutive period", k)) | ||
return warnings, errors | ||
} | ||
|
||
if len(segment) > 63 { | ||
errors = append(errors, fmt.Errorf("the each segment of the `email` must contain between 1 and 63 characters")) | ||
return warnings, errors | ||
} | ||
} | ||
|
||
if !regexp.MustCompile(`^[a-zA-Z\d._-]+$`).MatchString(value) { | ||
errors = append(errors, fmt.Errorf("%q only contains letters, numbers, underscores, dashes and periods", k)) | ||
return warnings, errors | ||
} | ||
|
||
return warnings, errors | ||
} |
Oops, something went wrong.