Skip to content

Commit 772851d

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add blockedRequestPatterns to synthetics browser test options (#3383)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 02bb2f8 commit 772851d

File tree

5 files changed

+53
-11
lines changed

5 files changed

+53
-11
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17343,6 +17343,11 @@ components:
1734317343
description: Allows loading insecure content for an HTTP request in an API
1734417344
test.
1734517345
type: boolean
17346+
blockedRequestPatterns:
17347+
description: Array of URL patterns to block.
17348+
items:
17349+
type: string
17350+
type: array
1734617351
checkCertificateRevocation:
1734717352
description: For SSL tests, whether or not the test should fail on revoked
1734817353
certificate in stapled OCSP.

api/datadogV1/model_synthetics_test_options.go

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ type SyntheticsTestOptions struct {
1515
AcceptSelfSigned *bool `json:"accept_self_signed,omitempty"`
1616
// Allows loading insecure content for an HTTP request in an API test.
1717
AllowInsecure *bool `json:"allow_insecure,omitempty"`
18+
// Array of URL patterns to block.
19+
BlockedRequestPatterns []string `json:"blockedRequestPatterns,omitempty"`
1820
// For SSL tests, whether or not the test should fail on revoked certificate in stapled OCSP.
1921
CheckCertificateRevocation *bool `json:"checkCertificateRevocation,omitempty"`
2022
// CI/CD options for a Synthetic test.
@@ -152,6 +154,34 @@ func (o *SyntheticsTestOptions) SetAllowInsecure(v bool) {
152154
o.AllowInsecure = &v
153155
}
154156

157+
// GetBlockedRequestPatterns returns the BlockedRequestPatterns field value if set, zero value otherwise.
158+
func (o *SyntheticsTestOptions) GetBlockedRequestPatterns() []string {
159+
if o == nil || o.BlockedRequestPatterns == nil {
160+
var ret []string
161+
return ret
162+
}
163+
return o.BlockedRequestPatterns
164+
}
165+
166+
// GetBlockedRequestPatternsOk returns a tuple with the BlockedRequestPatterns field value if set, nil otherwise
167+
// and a boolean to check if the value has been set.
168+
func (o *SyntheticsTestOptions) GetBlockedRequestPatternsOk() (*[]string, bool) {
169+
if o == nil || o.BlockedRequestPatterns == nil {
170+
return nil, false
171+
}
172+
return &o.BlockedRequestPatterns, true
173+
}
174+
175+
// HasBlockedRequestPatterns returns a boolean if a field has been set.
176+
func (o *SyntheticsTestOptions) HasBlockedRequestPatterns() bool {
177+
return o != nil && o.BlockedRequestPatterns != nil
178+
}
179+
180+
// SetBlockedRequestPatterns gets a reference to the given []string and assigns it to the BlockedRequestPatterns field.
181+
func (o *SyntheticsTestOptions) SetBlockedRequestPatterns(v []string) {
182+
o.BlockedRequestPatterns = v
183+
}
184+
155185
// GetCheckCertificateRevocation returns the CheckCertificateRevocation field value if set, zero value otherwise.
156186
func (o *SyntheticsTestOptions) GetCheckCertificateRevocation() bool {
157187
if o == nil || o.CheckCertificateRevocation == nil {
@@ -811,6 +841,9 @@ func (o SyntheticsTestOptions) MarshalJSON() ([]byte, error) {
811841
if o.AllowInsecure != nil {
812842
toSerialize["allow_insecure"] = o.AllowInsecure
813843
}
844+
if o.BlockedRequestPatterns != nil {
845+
toSerialize["blockedRequestPatterns"] = o.BlockedRequestPatterns
846+
}
814847
if o.CheckCertificateRevocation != nil {
815848
toSerialize["checkCertificateRevocation"] = o.CheckCertificateRevocation
816849
}
@@ -892,6 +925,7 @@ func (o *SyntheticsTestOptions) UnmarshalJSON(bytes []byte) (err error) {
892925
all := struct {
893926
AcceptSelfSigned *bool `json:"accept_self_signed,omitempty"`
894927
AllowInsecure *bool `json:"allow_insecure,omitempty"`
928+
BlockedRequestPatterns []string `json:"blockedRequestPatterns,omitempty"`
895929
CheckCertificateRevocation *bool `json:"checkCertificateRevocation,omitempty"`
896930
Ci *SyntheticsTestCiOptions `json:"ci,omitempty"`
897931
DeviceIds []string `json:"device_ids,omitempty"`
@@ -921,14 +955,15 @@ func (o *SyntheticsTestOptions) UnmarshalJSON(bytes []byte) (err error) {
921955
}
922956
additionalProperties := make(map[string]interface{})
923957
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
924-
datadog.DeleteKeys(additionalProperties, &[]string{"accept_self_signed", "allow_insecure", "checkCertificateRevocation", "ci", "device_ids", "disableAiaIntermediateFetching", "disableCors", "disableCsp", "enableProfiling", "enableSecurityTesting", "follow_redirects", "httpVersion", "ignoreServerCertificateError", "initialNavigationTimeout", "min_failure_duration", "min_location_failed", "monitor_name", "monitor_options", "monitor_priority", "noScreenshot", "restricted_roles", "retry", "rumSettings", "scheduling", "tick_every"})
958+
datadog.DeleteKeys(additionalProperties, &[]string{"accept_self_signed", "allow_insecure", "blockedRequestPatterns", "checkCertificateRevocation", "ci", "device_ids", "disableAiaIntermediateFetching", "disableCors", "disableCsp", "enableProfiling", "enableSecurityTesting", "follow_redirects", "httpVersion", "ignoreServerCertificateError", "initialNavigationTimeout", "min_failure_duration", "min_location_failed", "monitor_name", "monitor_options", "monitor_priority", "noScreenshot", "restricted_roles", "retry", "rumSettings", "scheduling", "tick_every"})
925959
} else {
926960
return err
927961
}
928962

929963
hasInvalidField := false
930964
o.AcceptSelfSigned = all.AcceptSelfSigned
931965
o.AllowInsecure = all.AllowInsecure
966+
o.BlockedRequestPatterns = all.BlockedRequestPatterns
932967
o.CheckCertificateRevocation = all.CheckCertificateRevocation
933968
if all.Ci != nil && all.Ci.UnparsedObject != nil && o.UnparsedObject == nil {
934969
hasInvalidField = true

examples/v1/synthetics/CreateSyntheticsAPITest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func main() {
3535
Message: "Notification message",
3636
Name: "Example test name",
3737
Options: datadogV1.SyntheticsTestOptions{
38+
BlockedRequestPatterns: []string{},
3839
Ci: &datadogV1.SyntheticsTestCiOptions{
3940
ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_BLOCKING,
4041
},

examples/v1/synthetics/UpdateBrowserTest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func main() {
6060
Message: "",
6161
Name: "Example test name",
6262
Options: datadogV1.SyntheticsTestOptions{
63+
BlockedRequestPatterns: []string{},
6364
Ci: &datadogV1.SyntheticsTestCiOptions{
6465
ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_BLOCKING,
6566
},

0 commit comments

Comments
 (0)