diff --git a/.apigentools-info b/.apigentools-info index 504016af484..267e77b2f08 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-11 17:25:14.651723", - "spec_repo_commit": "9de1804a" + "regenerated": "2024-11-12 16:11:25.057465", + "spec_repo_commit": "67b7e114" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-11 17:25:14.670393", - "spec_repo_commit": "9de1804a" + "regenerated": "2024-11-12 16:11:25.076160", + "spec_repo_commit": "67b7e114" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 81b91829196..17c5ec2e23a 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -17027,12 +17027,12 @@ components: SyntheticsTestRestrictionPolicyBinding: description: Objects describing the binding used for a mobile test. properties: - principal: - $ref: '#/components/schemas/SyntheticsTestRestrictionPolicyBindingPrincipal' + principals: + $ref: '#/components/schemas/SyntheticsTestRestrictionPolicyBindingPrincipals' relation: $ref: '#/components/schemas/SyntheticsTestRestrictionPolicyBindingRelation' type: object - SyntheticsTestRestrictionPolicyBindingPrincipal: + SyntheticsTestRestrictionPolicyBindingPrincipals: description: List of principals for a mobile test binding. items: description: A principal for a mobile test binding. diff --git a/api/datadogV1/model_synthetics_test_restriction_policy_binding.go b/api/datadogV1/model_synthetics_test_restriction_policy_binding.go index 24882074543..d9e3a4902e0 100644 --- a/api/datadogV1/model_synthetics_test_restriction_policy_binding.go +++ b/api/datadogV1/model_synthetics_test_restriction_policy_binding.go @@ -11,7 +11,7 @@ import ( // SyntheticsTestRestrictionPolicyBinding Objects describing the binding used for a mobile test. type SyntheticsTestRestrictionPolicyBinding struct { // List of principals for a mobile test binding. - Principal []string `json:"principal,omitempty"` + Principals []string `json:"principals,omitempty"` // The type of relation for the binding. Relation *SyntheticsTestRestrictionPolicyBindingRelation `json:"relation,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -36,32 +36,32 @@ func NewSyntheticsTestRestrictionPolicyBindingWithDefaults() *SyntheticsTestRest return &this } -// GetPrincipal returns the Principal field value if set, zero value otherwise. -func (o *SyntheticsTestRestrictionPolicyBinding) GetPrincipal() []string { - if o == nil || o.Principal == nil { +// GetPrincipals returns the Principals field value if set, zero value otherwise. +func (o *SyntheticsTestRestrictionPolicyBinding) GetPrincipals() []string { + if o == nil || o.Principals == nil { var ret []string return ret } - return o.Principal + return o.Principals } -// GetPrincipalOk returns a tuple with the Principal field value if set, nil otherwise +// GetPrincipalsOk returns a tuple with the Principals field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *SyntheticsTestRestrictionPolicyBinding) GetPrincipalOk() (*[]string, bool) { - if o == nil || o.Principal == nil { +func (o *SyntheticsTestRestrictionPolicyBinding) GetPrincipalsOk() (*[]string, bool) { + if o == nil || o.Principals == nil { return nil, false } - return &o.Principal, true + return &o.Principals, true } -// HasPrincipal returns a boolean if a field has been set. -func (o *SyntheticsTestRestrictionPolicyBinding) HasPrincipal() bool { - return o != nil && o.Principal != nil +// HasPrincipals returns a boolean if a field has been set. +func (o *SyntheticsTestRestrictionPolicyBinding) HasPrincipals() bool { + return o != nil && o.Principals != nil } -// SetPrincipal gets a reference to the given []string and assigns it to the Principal field. -func (o *SyntheticsTestRestrictionPolicyBinding) SetPrincipal(v []string) { - o.Principal = v +// SetPrincipals gets a reference to the given []string and assigns it to the Principals field. +func (o *SyntheticsTestRestrictionPolicyBinding) SetPrincipals(v []string) { + o.Principals = v } // GetRelation returns the Relation field value if set, zero value otherwise. @@ -98,8 +98,8 @@ func (o SyntheticsTestRestrictionPolicyBinding) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - if o.Principal != nil { - toSerialize["principal"] = o.Principal + if o.Principals != nil { + toSerialize["principals"] = o.Principals } if o.Relation != nil { toSerialize["relation"] = o.Relation @@ -114,21 +114,21 @@ func (o SyntheticsTestRestrictionPolicyBinding) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestRestrictionPolicyBinding) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Principal []string `json:"principal,omitempty"` - Relation *SyntheticsTestRestrictionPolicyBindingRelation `json:"relation,omitempty"` + Principals []string `json:"principals,omitempty"` + Relation *SyntheticsTestRestrictionPolicyBindingRelation `json:"relation,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"principal", "relation"}) + datadog.DeleteKeys(additionalProperties, &[]string{"principals", "relation"}) } else { return err } hasInvalidField := false - o.Principal = all.Principal + o.Principals = all.Principals if all.Relation != nil && !all.Relation.IsValid() { hasInvalidField = true } else { diff --git a/tests/scenarios/features/v1/synthetics.feature b/tests/scenarios/features/v1/synthetics.feature index be28590aed8..fb90d094941 100644 --- a/tests/scenarios/features/v1/synthetics.feature +++ b/tests/scenarios/features/v1/synthetics.feature @@ -128,7 +128,7 @@ Feature: Synthetics @generated @skip @team:DataDog/synthetics-ct Scenario: Create a mobile test returns "- JSON format is wrong" response Given new "CreateSyntheticsMobileTest" request - And body with value {"config": {"variables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}]}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "message": "Notification message", "name": "Example test name", "options": {"bindings": [{"principal": [], "relation": "editor"}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"applicationId": "00000000-0000-0000-0000-aaaaaaaaaaaa", "referenceId": "00000000-0000-0000-0000-aaaaaaaaaaab", "referenceType": "latest"}, "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}, "tick_every": 300}, "status": "live", "steps": [{"name": "", "params": {"check": "equals", "direction": "up", "element": {"contextType": "native", "relativePosition": {}, "userLocator": {"values": [{"type": "accessibility-id"}]}}, "positions": [{}], "variable": {"example": "", "name": "VAR_NAME"}}, "publicId": "pub-lic-id0", "type": "assertElementContent"}], "tags": ["env:production"], "type": "mobile"} + And body with value {"config": {"variables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}]}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "message": "Notification message", "name": "Example test name", "options": {"bindings": [{"principals": [], "relation": "editor"}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"applicationId": "00000000-0000-0000-0000-aaaaaaaaaaaa", "referenceId": "00000000-0000-0000-0000-aaaaaaaaaaab", "referenceType": "latest"}, "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}, "tick_every": 300}, "status": "live", "steps": [{"name": "", "params": {"check": "equals", "direction": "up", "element": {"contextType": "native", "relativePosition": {}, "userLocator": {"values": [{"type": "accessibility-id"}]}}, "positions": [{}], "variable": {"example": "", "name": "VAR_NAME"}}, "publicId": "pub-lic-id0", "type": "assertElementContent"}], "tags": ["env:production"], "type": "mobile"} When the request is sent Then the response status is 400 - JSON format is wrong @@ -147,7 +147,7 @@ Feature: Synthetics @generated @skip @team:DataDog/synthetics-ct Scenario: Create a mobile test returns "Test quota is reached" response Given new "CreateSyntheticsMobileTest" request - And body with value {"config": {"variables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}]}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "message": "Notification message", "name": "Example test name", "options": {"bindings": [{"principal": [], "relation": "editor"}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"applicationId": "00000000-0000-0000-0000-aaaaaaaaaaaa", "referenceId": "00000000-0000-0000-0000-aaaaaaaaaaab", "referenceType": "latest"}, "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}, "tick_every": 300}, "status": "live", "steps": [{"name": "", "params": {"check": "equals", "direction": "up", "element": {"contextType": "native", "relativePosition": {}, "userLocator": {"values": [{"type": "accessibility-id"}]}}, "positions": [{}], "variable": {"example": "", "name": "VAR_NAME"}}, "publicId": "pub-lic-id0", "type": "assertElementContent"}], "tags": ["env:production"], "type": "mobile"} + And body with value {"config": {"variables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}]}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "message": "Notification message", "name": "Example test name", "options": {"bindings": [{"principals": [], "relation": "editor"}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"applicationId": "00000000-0000-0000-0000-aaaaaaaaaaaa", "referenceId": "00000000-0000-0000-0000-aaaaaaaaaaab", "referenceType": "latest"}, "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}, "tick_every": 300}, "status": "live", "steps": [{"name": "", "params": {"check": "equals", "direction": "up", "element": {"contextType": "native", "relativePosition": {}, "userLocator": {"values": [{"type": "accessibility-id"}]}}, "positions": [{}], "variable": {"example": "", "name": "VAR_NAME"}}, "publicId": "pub-lic-id0", "type": "assertElementContent"}], "tags": ["env:production"], "type": "mobile"} When the request is sent Then the response status is 402 Test quota is reached @@ -361,7 +361,7 @@ Feature: Synthetics Scenario: Edit a Mobile test returns "- JSON format is wrong" response Given new "UpdateMobileTest" request And request contains "public_id" parameter from "REPLACE.ME" - And body with value {"config": {"variables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}]}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "message": "Notification message", "name": "Example test name", "options": {"bindings": [{"principal": [], "relation": "editor"}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"applicationId": "00000000-0000-0000-0000-aaaaaaaaaaaa", "referenceId": "00000000-0000-0000-0000-aaaaaaaaaaab", "referenceType": "latest"}, "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}, "tick_every": 300}, "status": "live", "steps": [{"name": "", "params": {"check": "equals", "direction": "up", "element": {"contextType": "native", "relativePosition": {}, "userLocator": {"values": [{"type": "accessibility-id"}]}}, "positions": [{}], "variable": {"example": "", "name": "VAR_NAME"}}, "publicId": "pub-lic-id0", "type": "assertElementContent"}], "tags": ["env:production"], "type": "mobile"} + And body with value {"config": {"variables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}]}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "message": "Notification message", "name": "Example test name", "options": {"bindings": [{"principals": [], "relation": "editor"}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"applicationId": "00000000-0000-0000-0000-aaaaaaaaaaaa", "referenceId": "00000000-0000-0000-0000-aaaaaaaaaaab", "referenceType": "latest"}, "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}, "tick_every": 300}, "status": "live", "steps": [{"name": "", "params": {"check": "equals", "direction": "up", "element": {"contextType": "native", "relativePosition": {}, "userLocator": {"values": [{"type": "accessibility-id"}]}}, "positions": [{}], "variable": {"example": "", "name": "VAR_NAME"}}, "publicId": "pub-lic-id0", "type": "assertElementContent"}], "tags": ["env:production"], "type": "mobile"} When the request is sent Then the response status is 400 - JSON format is wrong @@ -369,7 +369,7 @@ Feature: Synthetics Scenario: Edit a Mobile test returns "- Synthetic Monitoring is not activated for the user" response Given new "UpdateMobileTest" request And request contains "public_id" parameter from "REPLACE.ME" - And body with value {"config": {"variables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}]}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "message": "Notification message", "name": "Example test name", "options": {"bindings": [{"principal": [], "relation": "editor"}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"applicationId": "00000000-0000-0000-0000-aaaaaaaaaaaa", "referenceId": "00000000-0000-0000-0000-aaaaaaaaaaab", "referenceType": "latest"}, "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}, "tick_every": 300}, "status": "live", "steps": [{"name": "", "params": {"check": "equals", "direction": "up", "element": {"contextType": "native", "relativePosition": {}, "userLocator": {"values": [{"type": "accessibility-id"}]}}, "positions": [{}], "variable": {"example": "", "name": "VAR_NAME"}}, "publicId": "pub-lic-id0", "type": "assertElementContent"}], "tags": ["env:production"], "type": "mobile"} + And body with value {"config": {"variables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}]}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "message": "Notification message", "name": "Example test name", "options": {"bindings": [{"principals": [], "relation": "editor"}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"applicationId": "00000000-0000-0000-0000-aaaaaaaaaaaa", "referenceId": "00000000-0000-0000-0000-aaaaaaaaaaab", "referenceType": "latest"}, "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}, "tick_every": 300}, "status": "live", "steps": [{"name": "", "params": {"check": "equals", "direction": "up", "element": {"contextType": "native", "relativePosition": {}, "userLocator": {"values": [{"type": "accessibility-id"}]}}, "positions": [{}], "variable": {"example": "", "name": "VAR_NAME"}}, "publicId": "pub-lic-id0", "type": "assertElementContent"}], "tags": ["env:production"], "type": "mobile"} When the request is sent Then the response status is 404 - Synthetic Monitoring is not activated for the user