diff --git a/.apigentools-info b/.apigentools-info index 419ee84b0ce..a92f6f8d53d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-25 20:17:11.560714", - "spec_repo_commit": "849ce45c" + "regenerated": "2024-10-28 10:23:18.020045", + "spec_repo_commit": "2e09a3ec" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-25 20:17:11.579093", - "spec_repo_commit": "849ce45c" + "regenerated": "2024-10-28 10:23:18.039004", + "spec_repo_commit": "2e09a3ec" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index f1b3d1b0d6d..da8a645285d 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -15491,14 +15491,14 @@ components: type: boolean name: description: The name of the step. + example: '' maxLength: 1500 type: string noScreenshot: description: A boolean set to not take a screenshot for the step. type: boolean params: - description: The parameters of the mobile step. - type: object + $ref: '#/components/schemas/SyntheticsMobileStepParams' publicId: description: The public ID of the step. example: pub-lic-id0 @@ -15509,6 +15509,188 @@ components: type: integer type: $ref: '#/components/schemas/SyntheticsMobileStepType' + required: + - name + - params + - type + type: object + SyntheticsMobileStepParams: + description: The parameters of a mobile step. + properties: + check: + $ref: '#/components/schemas/SyntheticsCheckType' + delay: + description: Number of milliseconds to wait between inputs in a `typeText` + step type. + format: int64 + maximum: 5000 + minimum: 0 + type: integer + direction: + $ref: '#/components/schemas/SyntheticsMobileStepParamsDirection' + element: + $ref: '#/components/schemas/SyntheticsMobileStepParamsElement' + enable: + description: Boolean to change the state of the wifi for a `toggleWiFi` + step type. + type: boolean + maxScrolls: + description: Maximum number of scrolls to do for a `scrollToElement` step + type. + format: int64 + type: integer + positions: + $ref: '#/components/schemas/SyntheticsMobileStepParamsPositions' + subtestPublicId: + description: Public ID of the test to be played as part of a `playSubTest` + step type. + type: string + value: + description: Values used in the step. Used in multiple step types. + type: string + variable: + $ref: '#/components/schemas/SyntheticsMobileStepParamsVariable' + withEnter: + description: Boolean to indicate if `Enter` should be pressed at the end + of the `typeText` step type. + type: boolean + x: + description: Amount to scroll by on the `x` axis for a `scroll` step type. + format: int64 + type: integer + y: + description: Amount to scroll by on the `y` axis for a `scroll` step type. + format: int64 + type: integer + type: object + SyntheticsMobileStepParamsDirection: + description: The direction of the scroll for a `scrollToElement` step type. + enum: + - up + - down + - left + - right + type: string + x-enum-varnames: + - UP + - DOWN + - LEFT + - RIGHT + SyntheticsMobileStepParamsElement: + description: Information about the element used for a step. + properties: + context: + description: Context of the element. + type: string + contextType: + $ref: '#/components/schemas/SyntheticsMobileStepParamsElementContextType' + elementDescription: + description: Description of the element. + type: string + multiLocator: + description: Multi-locator to find the element. + type: object + relativePosition: + $ref: '#/components/schemas/SyntheticsMobileStepParamsElementRelativePosition' + textContent: + description: Text content of the element. + type: string + userLocator: + $ref: '#/components/schemas/SyntheticsMobileStepParamsElementUserLocator' + viewName: + description: Name of the view of the element. + type: string + type: object + SyntheticsMobileStepParamsElementContextType: + description: Type of the context that the element is in. + enum: + - native + - web + type: string + x-enum-varnames: + - NATIVE + - WEB + SyntheticsMobileStepParamsElementRelativePosition: + description: Position of the action relative to the element. + properties: + x: + description: The `relativePosition` on the `x` axis for the element. + format: int64 + type: integer + y: + description: The `relativePosition` on the `y` axis for the element. + format: int64 + type: integer + type: object + SyntheticsMobileStepParamsElementUserLocator: + description: User locator to find the element. + properties: + failTestOnCannotLocate: + description: Whether if the the test should fail if the element cannot be + found. + type: boolean + values: + description: Values of the user locator. + items: + $ref: '#/components/schemas/SyntheticsMobileStepParamsElementUserLocatorValuesItems' + type: array + type: object + SyntheticsMobileStepParamsElementUserLocatorValuesItems: + description: A single user locator object. + properties: + type: + $ref: '#/components/schemas/SyntheticsMobileStepParamsElementUserLocatorValuesItemsType' + value: + description: Value of a user locator. + type: string + type: object + SyntheticsMobileStepParamsElementUserLocatorValuesItemsType: + description: Type of a user locator. + enum: + - accessibility-id + - id + - ios-predicate-string + - ios-class-chain + - xpath + type: string + x-enum-varnames: + - ACCESSIBILITY_ID + - ID + - IOS_PREDICATE_STRING + - IOS_CLASS_CHAIN + - XPATH + SyntheticsMobileStepParamsPositions: + description: List of positions for the `flick` step type. The maximum is 10 + flicks per step + items: + $ref: '#/components/schemas/SyntheticsMobileStepParamsPositionsItems' + type: array + SyntheticsMobileStepParamsPositionsItems: + description: A description of a single position for a `flick` step type. + properties: + x: + description: The `x` position for the flick. + format: int64 + type: integer + y: + description: The `y` position for the flick. + format: int64 + type: integer + type: object + SyntheticsMobileStepParamsVariable: + description: Variable object for `extractVariable` step type. + properties: + example: + description: An example for the variable. + example: '' + type: string + name: + description: The variable name. + example: VAR_NAME + type: string + required: + - name + - example type: object SyntheticsMobileStepType: description: Step type used in your mobile Synthetic test. @@ -15556,7 +15738,7 @@ components: config: $ref: '#/components/schemas/SyntheticsMobileTestConfig' device_ids: - description: The `SyntheticsMobileTest` `device_ids`. + description: Array with the different device IDs used to run the test. items: $ref: '#/components/schemas/SyntheticsMobileDeviceID' type: array @@ -15604,44 +15786,6 @@ components: - options - type type: object - SyntheticsMobileTestBinding: - description: Objects describing the binding used for a mobile test. - properties: - items: - $ref: '#/components/schemas/SyntheticsMobileTestBindingItems' - type: object - SyntheticsMobileTestBindingItems: - description: Object describing the binding used for a mobile test. - properties: - principals: - $ref: '#/components/schemas/SyntheticsMobileTestBindingPrincipals' - role: - $ref: '#/components/schemas/SyntheticsMobileTestBindingItemsRole' - type: object - SyntheticsMobileTestBindingItemsRole: - description: The definition of `SyntheticsMobileTestBindingItemsRole` object. - enum: - - editor - - viewer - type: string - x-enum-varnames: - - EDITOR - - VIEWER - SyntheticsMobileTestBindingPrincipals: - description: List of principals for a mobile test binding. - items: - description: A principal for a mobile test binding. - maxLength: 1500 - type: string - type: array - SyntheticsMobileTestCiOptions: - description: CI/CD options for a Synthetic test. - properties: - executionRule: - $ref: '#/components/schemas/SyntheticsTestExecutionRule' - required: - - executionRule - type: object SyntheticsMobileTestConfig: description: Configuration object for a Synthetic mobile test. properties: @@ -15654,34 +15798,27 @@ components: type: array type: object SyntheticsMobileTestInitialApplicationArguments: + additionalProperties: + description: A single application argument. + type: string description: Initial application arguments for a mobile test. - properties: - propertyNames: - $ref: '#/components/schemas/SyntheticsMobileTestInitialApplicationArgumentsPropertyNames' - type: object - SyntheticsMobileTestInitialApplicationArgumentsPropertyNames: - description: Name of the property. - properties: - pattern: - description: The `propertyNames` `pattern`. - example: ^(?!_dd).*$ - type: string type: object SyntheticsMobileTestOptions: description: Object describing the extra options for a Synthetic test. properties: allowApplicationCrash: - description: The `SyntheticsMobileTestOptions` `allowApplicationCrash`. + description: A boolean to set if an application crash would mark the test + as failed. type: boolean bindings: description: Array of bindings used for the mobile test. items: - $ref: '#/components/schemas/SyntheticsMobileTestBinding' + $ref: '#/components/schemas/SyntheticsTestRestrictionPolicyBinding' type: array ci: - $ref: '#/components/schemas/SyntheticsMobileTestCiOptions' + $ref: '#/components/schemas/SyntheticsTestCiOptions' defaultStepTimeout: - description: The `SyntheticsMobileTestOptions` `defaultStepTimeout`. + description: The default timeout for steps in the test (in seconds). format: int32 maximum: 300 minimum: 1 @@ -15689,11 +15826,13 @@ components: device_ids: description: For mobile test, array with the different device IDs used to run the test. + example: + - synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16 items: $ref: '#/components/schemas/SyntheticsMobileDeviceID' type: array disableAutoAcceptAlert: - description: The `SyntheticsMobileTestOptions` `disableAutoAcceptAlert`. + description: A boolean to disable auto accepting alerts. type: boolean min_failure_duration: description: Minimum amount of time in failure required to trigger an alert. @@ -15708,7 +15847,7 @@ components: all monitor dashboard widgets and SLOs. type: string monitor_options: - $ref: '#/components/schemas/SyntheticsMobileTestOptionsMonitorOptions' + $ref: '#/components/schemas/SyntheticsTestOptionsMonitorOptions' monitor_priority: description: Integer from 1 (high) to 5 (low) indicating alert severity. format: int32 @@ -15716,7 +15855,7 @@ components: minimum: 1 type: integer noScreenshot: - description: The `SyntheticsMobileTestOptions` `noScreenshot`. + description: A boolean set to not take a screenshot for the step. type: boolean restricted_roles: $ref: '#/components/schemas/SyntheticsRestrictedRoles' @@ -15726,54 +15865,22 @@ components: $ref: '#/components/schemas/SyntheticsTestOptionsScheduling' tick_every: description: The frequency at which to run the Synthetic test (in seconds). + example: 300 format: int64 maximum: 604800 minimum: 300 type: integer verbosity: - description: The `SyntheticsMobileTestOptions` `verbosity`. + description: The level of verbosity for the mobile test. format: int32 maximum: 5 minimum: 0 type: integer + required: + - device_ids + - tick_every + - mobileApplication type: object - SyntheticsMobileTestOptionsMonitorOptions: - description: 'Object containing the options for a mobile Synthetic test as a - monitor - - (for example, renotification).' - properties: - escalation_message: - description: Message to include in the escalation notification. - type: string - notification_preset_name: - $ref: '#/components/schemas/SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName' - renotify_interval: - description: 'Time interval before renotifying if the test is still failing - - (in minutes).' - format: int64 - minimum: 0 - type: integer - renotify_occurrences: - description: The `SyntheticsMobileTestOptionsMonitorOptions` `renotify_occurrences`. - format: int64 - type: integer - type: object - SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName: - description: The definition of `SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName` - object. - enum: - - show_all - - hide_all - - hide_query - - hide_handles - type: string - x-enum-varnames: - - SHOW_ALL - - HIDE_ALL - - HIDE_QUERY - - HIDE_HANDLES SyntheticsMobileTestType: default: mobile description: Type of the Synthetic test, `mobile`. @@ -15788,14 +15895,20 @@ components: properties: applicationId: description: Application ID of the mobile application. + example: 00000000-0000-0000-0000-aaaaaaaaaaaa maxLength: 1500 type: string referenceId: description: Reference ID of the mobile application. + example: 00000000-0000-0000-0000-aaaaaaaaaaab maxLength: 1500 type: string referenceType: $ref: '#/components/schemas/SyntheticsMobileTestsMobileApplicationReferenceType' + required: + - applicationId + - referenceId + - referenceType type: object SyntheticsMobileTestsMobileApplicationReferenceType: description: Reference type for the mobile application for a mobile synthetics @@ -15803,6 +15916,7 @@ components: enum: - latest - version + example: latest type: string x-enum-varnames: - LATEST @@ -16276,6 +16390,8 @@ components: properties: executionRule: $ref: '#/components/schemas/SyntheticsTestExecutionRule' + required: + - executionRule type: object SyntheticsTestConfig: description: Configuration object for a Synthetic test. @@ -16537,6 +16653,11 @@ components: (for example, renotification).' properties: + escalation_message: + description: Message to include in the escalation notification. + type: string + notification_preset_name: + $ref: '#/components/schemas/SyntheticsTestOptionsMonitorOptionsNotificationPresetName' renotify_interval: description: 'Time interval before renotifying if the test is still failing @@ -16544,7 +16665,24 @@ components: format: int64 minimum: 0 type: integer + renotify_occurrences: + description: The number of times to renotify if the test is still failing. + format: int64 + type: integer type: object + SyntheticsTestOptionsMonitorOptionsNotificationPresetName: + description: The name of the preset for the notification for the monitor. + enum: + - show_all + - hide_all + - hide_query + - hide_handles + type: string + x-enum-varnames: + - SHOW_ALL + - HIDE_ALL + - HIDE_QUERY + - HIDE_HANDLES SyntheticsTestOptionsRetry: description: Object describing the retry strategy to apply to a Synthetic test. properties: @@ -16583,6 +16721,9 @@ components: description: Timezone in which the timeframe is based. example: America/New_York type: string + required: + - timeframes + - timezone type: object SyntheticsTestOptionsSchedulingTimeframe: description: Object describing a timeframe. @@ -16602,6 +16743,10 @@ components: description: The hour of the day on which scheduling ends. example: '16:00' type: string + required: + - day + - from + - to type: object SyntheticsTestPauseStatus: description: 'Define whether you want to start (`live`) or pause (`paused`) @@ -16838,6 +16983,30 @@ components: description: String Port number to use when performing the test. Supports templated variables. type: string + SyntheticsTestRestrictionPolicyBinding: + description: Objects describing the binding used for a mobile test. + properties: + principals: + $ref: '#/components/schemas/SyntheticsTestRestrictionPolicyBindingPrincipals' + relation: + $ref: '#/components/schemas/SyntheticsTestRestrictionPolicyBindingRelation' + type: object + SyntheticsTestRestrictionPolicyBindingPrincipals: + description: List of principals for a mobile test binding. + items: + description: A principal for a mobile test binding. + maxLength: 1500 + type: string + type: array + SyntheticsTestRestrictionPolicyBindingRelation: + description: The type of relation for the binding. + enum: + - editor + - viewer + type: string + x-enum-varnames: + - EDITOR + - VIEWER SyntheticsTestUptime: description: Object containing the uptime for a Synthetic test ID. properties: diff --git a/api/datadogV1/model_synthetics_mobile_step.go b/api/datadogV1/model_synthetics_mobile_step.go index 556b0403ba1..d9b7f724e16 100644 --- a/api/datadogV1/model_synthetics_mobile_step.go +++ b/api/datadogV1/model_synthetics_mobile_step.go @@ -5,6 +5,8 @@ package datadogV1 import ( + "fmt" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) @@ -17,17 +19,17 @@ type SyntheticsMobileStep struct { // A boolean to use in addition to `allowFailure` to determine if the test should be marked as failed when the step fails. IsCritical *bool `json:"isCritical,omitempty"` // The name of the step. - Name *string `json:"name,omitempty"` + Name string `json:"name"` // A boolean set to not take a screenshot for the step. NoScreenshot *bool `json:"noScreenshot,omitempty"` - // The parameters of the mobile step. - Params interface{} `json:"params,omitempty"` + // The parameters of a mobile step. + Params SyntheticsMobileStepParams `json:"params"` // The public ID of the step. PublicId *string `json:"publicId,omitempty"` // The time before declaring a step failed. Timeout *int64 `json:"timeout,omitempty"` // Step type used in your mobile Synthetic test. - Type *SyntheticsMobileStepType `json:"type,omitempty"` + Type SyntheticsMobileStepType `json:"type"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -37,8 +39,11 @@ type SyntheticsMobileStep struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSyntheticsMobileStep() *SyntheticsMobileStep { +func NewSyntheticsMobileStep(name string, params SyntheticsMobileStepParams, typeVar SyntheticsMobileStepType) *SyntheticsMobileStep { this := SyntheticsMobileStep{} + this.Name = name + this.Params = params + this.Type = typeVar return &this } @@ -134,32 +139,27 @@ func (o *SyntheticsMobileStep) SetIsCritical(v bool) { o.IsCritical = &v } -// GetName returns the Name field value if set, zero value otherwise. +// GetName returns the Name field value. func (o *SyntheticsMobileStep) GetName() string { - if o == nil || o.Name == nil { + if o == nil { var ret string return ret } - return *o.Name + return o.Name } -// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. func (o *SyntheticsMobileStep) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { + if o == nil { return nil, false } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *SyntheticsMobileStep) HasName() bool { - return o != nil && o.Name != nil + return &o.Name, true } -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName sets field value. func (o *SyntheticsMobileStep) SetName(v string) { - o.Name = &v + o.Name = v } // GetNoScreenshot returns the NoScreenshot field value if set, zero value otherwise. @@ -190,31 +190,26 @@ func (o *SyntheticsMobileStep) SetNoScreenshot(v bool) { o.NoScreenshot = &v } -// GetParams returns the Params field value if set, zero value otherwise. -func (o *SyntheticsMobileStep) GetParams() interface{} { - if o == nil || o.Params == nil { - var ret interface{} +// GetParams returns the Params field value. +func (o *SyntheticsMobileStep) GetParams() SyntheticsMobileStepParams { + if o == nil { + var ret SyntheticsMobileStepParams return ret } return o.Params } -// GetParamsOk returns a tuple with the Params field value if set, nil otherwise +// GetParamsOk returns a tuple with the Params field value // and a boolean to check if the value has been set. -func (o *SyntheticsMobileStep) GetParamsOk() (*interface{}, bool) { - if o == nil || o.Params == nil { +func (o *SyntheticsMobileStep) GetParamsOk() (*SyntheticsMobileStepParams, bool) { + if o == nil { return nil, false } return &o.Params, true } -// HasParams returns a boolean if a field has been set. -func (o *SyntheticsMobileStep) HasParams() bool { - return o != nil && o.Params != nil -} - -// SetParams gets a reference to the given interface{} and assigns it to the Params field. -func (o *SyntheticsMobileStep) SetParams(v interface{}) { +// SetParams sets field value. +func (o *SyntheticsMobileStep) SetParams(v SyntheticsMobileStepParams) { o.Params = v } @@ -274,32 +269,27 @@ func (o *SyntheticsMobileStep) SetTimeout(v int64) { o.Timeout = &v } -// GetType returns the Type field value if set, zero value otherwise. +// GetType returns the Type field value. func (o *SyntheticsMobileStep) GetType() SyntheticsMobileStepType { - if o == nil || o.Type == nil { + if o == nil { var ret SyntheticsMobileStepType return ret } - return *o.Type + return o.Type } -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// GetTypeOk returns a tuple with the Type field value // and a boolean to check if the value has been set. func (o *SyntheticsMobileStep) GetTypeOk() (*SyntheticsMobileStepType, bool) { - if o == nil || o.Type == nil { + if o == nil { return nil, false } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *SyntheticsMobileStep) HasType() bool { - return o != nil && o.Type != nil + return &o.Type, true } -// SetType gets a reference to the given SyntheticsMobileStepType and assigns it to the Type field. +// SetType sets field value. func (o *SyntheticsMobileStep) SetType(v SyntheticsMobileStepType) { - o.Type = &v + o.Type = v } // MarshalJSON serializes the struct using spec logic. @@ -317,24 +307,18 @@ func (o SyntheticsMobileStep) MarshalJSON() ([]byte, error) { if o.IsCritical != nil { toSerialize["isCritical"] = o.IsCritical } - if o.Name != nil { - toSerialize["name"] = o.Name - } + toSerialize["name"] = o.Name if o.NoScreenshot != nil { toSerialize["noScreenshot"] = o.NoScreenshot } - if o.Params != nil { - toSerialize["params"] = o.Params - } + toSerialize["params"] = o.Params if o.PublicId != nil { toSerialize["publicId"] = o.PublicId } if o.Timeout != nil { toSerialize["timeout"] = o.Timeout } - if o.Type != nil { - toSerialize["type"] = o.Type - } + toSerialize["type"] = o.Type for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -345,19 +329,28 @@ func (o SyntheticsMobileStep) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsMobileStep) UnmarshalJSON(bytes []byte) (err error) { all := struct { - AllowFailure *bool `json:"allowFailure,omitempty"` - HasNewStepElement *bool `json:"hasNewStepElement,omitempty"` - IsCritical *bool `json:"isCritical,omitempty"` - Name *string `json:"name,omitempty"` - NoScreenshot *bool `json:"noScreenshot,omitempty"` - Params interface{} `json:"params,omitempty"` - PublicId *string `json:"publicId,omitempty"` - Timeout *int64 `json:"timeout,omitempty"` - Type *SyntheticsMobileStepType `json:"type,omitempty"` + AllowFailure *bool `json:"allowFailure,omitempty"` + HasNewStepElement *bool `json:"hasNewStepElement,omitempty"` + IsCritical *bool `json:"isCritical,omitempty"` + Name *string `json:"name"` + NoScreenshot *bool `json:"noScreenshot,omitempty"` + Params *SyntheticsMobileStepParams `json:"params"` + PublicId *string `json:"publicId,omitempty"` + Timeout *int64 `json:"timeout,omitempty"` + Type *SyntheticsMobileStepType `json:"type"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Params == nil { + return fmt.Errorf("required field params missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"allowFailure", "hasNewStepElement", "isCritical", "name", "noScreenshot", "params", "publicId", "timeout", "type"}) @@ -369,15 +362,18 @@ func (o *SyntheticsMobileStep) UnmarshalJSON(bytes []byte) (err error) { o.AllowFailure = all.AllowFailure o.HasNewStepElement = all.HasNewStepElement o.IsCritical = all.IsCritical - o.Name = all.Name + o.Name = *all.Name o.NoScreenshot = all.NoScreenshot - o.Params = all.Params + if all.Params.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Params = *all.Params o.PublicId = all.PublicId o.Timeout = all.Timeout - if all.Type != nil && !all.Type.IsValid() { + if !all.Type.IsValid() { hasInvalidField = true } else { - o.Type = all.Type + o.Type = *all.Type } if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_synthetics_mobile_step_params.go b/api/datadogV1/model_synthetics_mobile_step_params.go new file mode 100644 index 00000000000..98673776d7a --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params.go @@ -0,0 +1,542 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParams The parameters of a mobile step. +type SyntheticsMobileStepParams struct { + // Type of assertion to apply in an API test. + Check *SyntheticsCheckType `json:"check,omitempty"` + // Number of milliseconds to wait between inputs in a `typeText` step type. + Delay *int64 `json:"delay,omitempty"` + // The direction of the scroll for a `scrollToElement` step type. + Direction *SyntheticsMobileStepParamsDirection `json:"direction,omitempty"` + // Information about the element used for a step. + Element *SyntheticsMobileStepParamsElement `json:"element,omitempty"` + // Boolean to change the state of the wifi for a `toggleWiFi` step type. + Enable *bool `json:"enable,omitempty"` + // Maximum number of scrolls to do for a `scrollToElement` step type. + MaxScrolls *int64 `json:"maxScrolls,omitempty"` + // List of positions for the `flick` step type. The maximum is 10 flicks per step + Positions []SyntheticsMobileStepParamsPositionsItems `json:"positions,omitempty"` + // Public ID of the test to be played as part of a `playSubTest` step type. + SubtestPublicId *string `json:"subtestPublicId,omitempty"` + // Values used in the step. Used in multiple step types. + Value *string `json:"value,omitempty"` + // Variable object for `extractVariable` step type. + Variable *SyntheticsMobileStepParamsVariable `json:"variable,omitempty"` + // Boolean to indicate if `Enter` should be pressed at the end of the `typeText` step type. + WithEnter *bool `json:"withEnter,omitempty"` + // Amount to scroll by on the `x` axis for a `scroll` step type. + X *int64 `json:"x,omitempty"` + // Amount to scroll by on the `y` axis for a `scroll` step type. + Y *int64 `json:"y,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSyntheticsMobileStepParams instantiates a new SyntheticsMobileStepParams object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSyntheticsMobileStepParams() *SyntheticsMobileStepParams { + this := SyntheticsMobileStepParams{} + return &this +} + +// NewSyntheticsMobileStepParamsWithDefaults instantiates a new SyntheticsMobileStepParams object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSyntheticsMobileStepParamsWithDefaults() *SyntheticsMobileStepParams { + this := SyntheticsMobileStepParams{} + return &this +} + +// GetCheck returns the Check field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetCheck() SyntheticsCheckType { + if o == nil || o.Check == nil { + var ret SyntheticsCheckType + return ret + } + return *o.Check +} + +// GetCheckOk returns a tuple with the Check field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetCheckOk() (*SyntheticsCheckType, bool) { + if o == nil || o.Check == nil { + return nil, false + } + return o.Check, true +} + +// HasCheck returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasCheck() bool { + return o != nil && o.Check != nil +} + +// SetCheck gets a reference to the given SyntheticsCheckType and assigns it to the Check field. +func (o *SyntheticsMobileStepParams) SetCheck(v SyntheticsCheckType) { + o.Check = &v +} + +// GetDelay returns the Delay field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetDelay() int64 { + if o == nil || o.Delay == nil { + var ret int64 + return ret + } + return *o.Delay +} + +// GetDelayOk returns a tuple with the Delay field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetDelayOk() (*int64, bool) { + if o == nil || o.Delay == nil { + return nil, false + } + return o.Delay, true +} + +// HasDelay returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasDelay() bool { + return o != nil && o.Delay != nil +} + +// SetDelay gets a reference to the given int64 and assigns it to the Delay field. +func (o *SyntheticsMobileStepParams) SetDelay(v int64) { + o.Delay = &v +} + +// GetDirection returns the Direction field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetDirection() SyntheticsMobileStepParamsDirection { + if o == nil || o.Direction == nil { + var ret SyntheticsMobileStepParamsDirection + return ret + } + return *o.Direction +} + +// GetDirectionOk returns a tuple with the Direction field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetDirectionOk() (*SyntheticsMobileStepParamsDirection, bool) { + if o == nil || o.Direction == nil { + return nil, false + } + return o.Direction, true +} + +// HasDirection returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasDirection() bool { + return o != nil && o.Direction != nil +} + +// SetDirection gets a reference to the given SyntheticsMobileStepParamsDirection and assigns it to the Direction field. +func (o *SyntheticsMobileStepParams) SetDirection(v SyntheticsMobileStepParamsDirection) { + o.Direction = &v +} + +// GetElement returns the Element field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetElement() SyntheticsMobileStepParamsElement { + if o == nil || o.Element == nil { + var ret SyntheticsMobileStepParamsElement + return ret + } + return *o.Element +} + +// GetElementOk returns a tuple with the Element field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetElementOk() (*SyntheticsMobileStepParamsElement, bool) { + if o == nil || o.Element == nil { + return nil, false + } + return o.Element, true +} + +// HasElement returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasElement() bool { + return o != nil && o.Element != nil +} + +// SetElement gets a reference to the given SyntheticsMobileStepParamsElement and assigns it to the Element field. +func (o *SyntheticsMobileStepParams) SetElement(v SyntheticsMobileStepParamsElement) { + o.Element = &v +} + +// GetEnable returns the Enable field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetEnable() bool { + if o == nil || o.Enable == nil { + var ret bool + return ret + } + return *o.Enable +} + +// GetEnableOk returns a tuple with the Enable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetEnableOk() (*bool, bool) { + if o == nil || o.Enable == nil { + return nil, false + } + return o.Enable, true +} + +// HasEnable returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasEnable() bool { + return o != nil && o.Enable != nil +} + +// SetEnable gets a reference to the given bool and assigns it to the Enable field. +func (o *SyntheticsMobileStepParams) SetEnable(v bool) { + o.Enable = &v +} + +// GetMaxScrolls returns the MaxScrolls field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetMaxScrolls() int64 { + if o == nil || o.MaxScrolls == nil { + var ret int64 + return ret + } + return *o.MaxScrolls +} + +// GetMaxScrollsOk returns a tuple with the MaxScrolls field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetMaxScrollsOk() (*int64, bool) { + if o == nil || o.MaxScrolls == nil { + return nil, false + } + return o.MaxScrolls, true +} + +// HasMaxScrolls returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasMaxScrolls() bool { + return o != nil && o.MaxScrolls != nil +} + +// SetMaxScrolls gets a reference to the given int64 and assigns it to the MaxScrolls field. +func (o *SyntheticsMobileStepParams) SetMaxScrolls(v int64) { + o.MaxScrolls = &v +} + +// GetPositions returns the Positions field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetPositions() []SyntheticsMobileStepParamsPositionsItems { + if o == nil || o.Positions == nil { + var ret []SyntheticsMobileStepParamsPositionsItems + return ret + } + return o.Positions +} + +// GetPositionsOk returns a tuple with the Positions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetPositionsOk() (*[]SyntheticsMobileStepParamsPositionsItems, bool) { + if o == nil || o.Positions == nil { + return nil, false + } + return &o.Positions, true +} + +// HasPositions returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasPositions() bool { + return o != nil && o.Positions != nil +} + +// SetPositions gets a reference to the given []SyntheticsMobileStepParamsPositionsItems and assigns it to the Positions field. +func (o *SyntheticsMobileStepParams) SetPositions(v []SyntheticsMobileStepParamsPositionsItems) { + o.Positions = v +} + +// GetSubtestPublicId returns the SubtestPublicId field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetSubtestPublicId() string { + if o == nil || o.SubtestPublicId == nil { + var ret string + return ret + } + return *o.SubtestPublicId +} + +// GetSubtestPublicIdOk returns a tuple with the SubtestPublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetSubtestPublicIdOk() (*string, bool) { + if o == nil || o.SubtestPublicId == nil { + return nil, false + } + return o.SubtestPublicId, true +} + +// HasSubtestPublicId returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasSubtestPublicId() bool { + return o != nil && o.SubtestPublicId != nil +} + +// SetSubtestPublicId gets a reference to the given string and assigns it to the SubtestPublicId field. +func (o *SyntheticsMobileStepParams) SetSubtestPublicId(v string) { + o.SubtestPublicId = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *SyntheticsMobileStepParams) SetValue(v string) { + o.Value = &v +} + +// GetVariable returns the Variable field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetVariable() SyntheticsMobileStepParamsVariable { + if o == nil || o.Variable == nil { + var ret SyntheticsMobileStepParamsVariable + return ret + } + return *o.Variable +} + +// GetVariableOk returns a tuple with the Variable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetVariableOk() (*SyntheticsMobileStepParamsVariable, bool) { + if o == nil || o.Variable == nil { + return nil, false + } + return o.Variable, true +} + +// HasVariable returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasVariable() bool { + return o != nil && o.Variable != nil +} + +// SetVariable gets a reference to the given SyntheticsMobileStepParamsVariable and assigns it to the Variable field. +func (o *SyntheticsMobileStepParams) SetVariable(v SyntheticsMobileStepParamsVariable) { + o.Variable = &v +} + +// GetWithEnter returns the WithEnter field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetWithEnter() bool { + if o == nil || o.WithEnter == nil { + var ret bool + return ret + } + return *o.WithEnter +} + +// GetWithEnterOk returns a tuple with the WithEnter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetWithEnterOk() (*bool, bool) { + if o == nil || o.WithEnter == nil { + return nil, false + } + return o.WithEnter, true +} + +// HasWithEnter returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasWithEnter() bool { + return o != nil && o.WithEnter != nil +} + +// SetWithEnter gets a reference to the given bool and assigns it to the WithEnter field. +func (o *SyntheticsMobileStepParams) SetWithEnter(v bool) { + o.WithEnter = &v +} + +// GetX returns the X field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetX() int64 { + if o == nil || o.X == nil { + var ret int64 + return ret + } + return *o.X +} + +// GetXOk returns a tuple with the X field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetXOk() (*int64, bool) { + if o == nil || o.X == nil { + return nil, false + } + return o.X, true +} + +// HasX returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasX() bool { + return o != nil && o.X != nil +} + +// SetX gets a reference to the given int64 and assigns it to the X field. +func (o *SyntheticsMobileStepParams) SetX(v int64) { + o.X = &v +} + +// GetY returns the Y field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParams) GetY() int64 { + if o == nil || o.Y == nil { + var ret int64 + return ret + } + return *o.Y +} + +// GetYOk returns a tuple with the Y field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParams) GetYOk() (*int64, bool) { + if o == nil || o.Y == nil { + return nil, false + } + return o.Y, true +} + +// HasY returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParams) HasY() bool { + return o != nil && o.Y != nil +} + +// SetY gets a reference to the given int64 and assigns it to the Y field. +func (o *SyntheticsMobileStepParams) SetY(v int64) { + o.Y = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsMobileStepParams) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Check != nil { + toSerialize["check"] = o.Check + } + if o.Delay != nil { + toSerialize["delay"] = o.Delay + } + if o.Direction != nil { + toSerialize["direction"] = o.Direction + } + if o.Element != nil { + toSerialize["element"] = o.Element + } + if o.Enable != nil { + toSerialize["enable"] = o.Enable + } + if o.MaxScrolls != nil { + toSerialize["maxScrolls"] = o.MaxScrolls + } + if o.Positions != nil { + toSerialize["positions"] = o.Positions + } + if o.SubtestPublicId != nil { + toSerialize["subtestPublicId"] = o.SubtestPublicId + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + if o.Variable != nil { + toSerialize["variable"] = o.Variable + } + if o.WithEnter != nil { + toSerialize["withEnter"] = o.WithEnter + } + if o.X != nil { + toSerialize["x"] = o.X + } + if o.Y != nil { + toSerialize["y"] = o.Y + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsMobileStepParams) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Check *SyntheticsCheckType `json:"check,omitempty"` + Delay *int64 `json:"delay,omitempty"` + Direction *SyntheticsMobileStepParamsDirection `json:"direction,omitempty"` + Element *SyntheticsMobileStepParamsElement `json:"element,omitempty"` + Enable *bool `json:"enable,omitempty"` + MaxScrolls *int64 `json:"maxScrolls,omitempty"` + Positions []SyntheticsMobileStepParamsPositionsItems `json:"positions,omitempty"` + SubtestPublicId *string `json:"subtestPublicId,omitempty"` + Value *string `json:"value,omitempty"` + Variable *SyntheticsMobileStepParamsVariable `json:"variable,omitempty"` + WithEnter *bool `json:"withEnter,omitempty"` + X *int64 `json:"x,omitempty"` + Y *int64 `json:"y,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{"check", "delay", "direction", "element", "enable", "maxScrolls", "positions", "subtestPublicId", "value", "variable", "withEnter", "x", "y"}) + } else { + return err + } + + hasInvalidField := false + if all.Check != nil && !all.Check.IsValid() { + hasInvalidField = true + } else { + o.Check = all.Check + } + o.Delay = all.Delay + if all.Direction != nil && !all.Direction.IsValid() { + hasInvalidField = true + } else { + o.Direction = all.Direction + } + if all.Element != nil && all.Element.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Element = all.Element + o.Enable = all.Enable + o.MaxScrolls = all.MaxScrolls + o.Positions = all.Positions + o.SubtestPublicId = all.SubtestPublicId + o.Value = all.Value + if all.Variable != nil && all.Variable.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Variable = all.Variable + o.WithEnter = all.WithEnter + o.X = all.X + o.Y = all.Y + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV1/model_synthetics_mobile_step_params_direction.go b/api/datadogV1/model_synthetics_mobile_step_params_direction.go new file mode 100644 index 00000000000..e20af752d70 --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params_direction.go @@ -0,0 +1,70 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParamsDirection The direction of the scroll for a `scrollToElement` step type. +type SyntheticsMobileStepParamsDirection string + +// List of SyntheticsMobileStepParamsDirection. +const ( + SYNTHETICSMOBILESTEPPARAMSDIRECTION_UP SyntheticsMobileStepParamsDirection = "up" + SYNTHETICSMOBILESTEPPARAMSDIRECTION_DOWN SyntheticsMobileStepParamsDirection = "down" + SYNTHETICSMOBILESTEPPARAMSDIRECTION_LEFT SyntheticsMobileStepParamsDirection = "left" + SYNTHETICSMOBILESTEPPARAMSDIRECTION_RIGHT SyntheticsMobileStepParamsDirection = "right" +) + +var allowedSyntheticsMobileStepParamsDirectionEnumValues = []SyntheticsMobileStepParamsDirection{ + SYNTHETICSMOBILESTEPPARAMSDIRECTION_UP, + SYNTHETICSMOBILESTEPPARAMSDIRECTION_DOWN, + SYNTHETICSMOBILESTEPPARAMSDIRECTION_LEFT, + SYNTHETICSMOBILESTEPPARAMSDIRECTION_RIGHT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsMobileStepParamsDirection) GetAllowedValues() []SyntheticsMobileStepParamsDirection { + return allowedSyntheticsMobileStepParamsDirectionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsMobileStepParamsDirection) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsMobileStepParamsDirection(value) + return nil +} + +// NewSyntheticsMobileStepParamsDirectionFromValue returns a pointer to a valid SyntheticsMobileStepParamsDirection +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsMobileStepParamsDirectionFromValue(v string) (*SyntheticsMobileStepParamsDirection, error) { + ev := SyntheticsMobileStepParamsDirection(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsMobileStepParamsDirection: valid values are %v", v, allowedSyntheticsMobileStepParamsDirectionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsMobileStepParamsDirection) IsValid() bool { + for _, existing := range allowedSyntheticsMobileStepParamsDirectionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsMobileStepParamsDirection value. +func (v SyntheticsMobileStepParamsDirection) Ptr() *SyntheticsMobileStepParamsDirection { + return &v +} diff --git a/api/datadogV1/model_synthetics_mobile_step_params_element.go b/api/datadogV1/model_synthetics_mobile_step_params_element.go new file mode 100644 index 00000000000..21011dad3b2 --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params_element.go @@ -0,0 +1,363 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParamsElement Information about the element used for a step. +type SyntheticsMobileStepParamsElement struct { + // Context of the element. + Context *string `json:"context,omitempty"` + // Type of the context that the element is in. + ContextType *SyntheticsMobileStepParamsElementContextType `json:"contextType,omitempty"` + // Description of the element. + ElementDescription *string `json:"elementDescription,omitempty"` + // Multi-locator to find the element. + MultiLocator interface{} `json:"multiLocator,omitempty"` + // Position of the action relative to the element. + RelativePosition *SyntheticsMobileStepParamsElementRelativePosition `json:"relativePosition,omitempty"` + // Text content of the element. + TextContent *string `json:"textContent,omitempty"` + // User locator to find the element. + UserLocator *SyntheticsMobileStepParamsElementUserLocator `json:"userLocator,omitempty"` + // Name of the view of the element. + ViewName *string `json:"viewName,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSyntheticsMobileStepParamsElement instantiates a new SyntheticsMobileStepParamsElement object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSyntheticsMobileStepParamsElement() *SyntheticsMobileStepParamsElement { + this := SyntheticsMobileStepParamsElement{} + return &this +} + +// NewSyntheticsMobileStepParamsElementWithDefaults instantiates a new SyntheticsMobileStepParamsElement object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSyntheticsMobileStepParamsElementWithDefaults() *SyntheticsMobileStepParamsElement { + this := SyntheticsMobileStepParamsElement{} + return &this +} + +// GetContext returns the Context field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElement) GetContext() string { + if o == nil || o.Context == nil { + var ret string + return ret + } + return *o.Context +} + +// GetContextOk returns a tuple with the Context field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElement) GetContextOk() (*string, bool) { + if o == nil || o.Context == nil { + return nil, false + } + return o.Context, true +} + +// HasContext returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElement) HasContext() bool { + return o != nil && o.Context != nil +} + +// SetContext gets a reference to the given string and assigns it to the Context field. +func (o *SyntheticsMobileStepParamsElement) SetContext(v string) { + o.Context = &v +} + +// GetContextType returns the ContextType field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElement) GetContextType() SyntheticsMobileStepParamsElementContextType { + if o == nil || o.ContextType == nil { + var ret SyntheticsMobileStepParamsElementContextType + return ret + } + return *o.ContextType +} + +// GetContextTypeOk returns a tuple with the ContextType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElement) GetContextTypeOk() (*SyntheticsMobileStepParamsElementContextType, bool) { + if o == nil || o.ContextType == nil { + return nil, false + } + return o.ContextType, true +} + +// HasContextType returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElement) HasContextType() bool { + return o != nil && o.ContextType != nil +} + +// SetContextType gets a reference to the given SyntheticsMobileStepParamsElementContextType and assigns it to the ContextType field. +func (o *SyntheticsMobileStepParamsElement) SetContextType(v SyntheticsMobileStepParamsElementContextType) { + o.ContextType = &v +} + +// GetElementDescription returns the ElementDescription field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElement) GetElementDescription() string { + if o == nil || o.ElementDescription == nil { + var ret string + return ret + } + return *o.ElementDescription +} + +// GetElementDescriptionOk returns a tuple with the ElementDescription field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElement) GetElementDescriptionOk() (*string, bool) { + if o == nil || o.ElementDescription == nil { + return nil, false + } + return o.ElementDescription, true +} + +// HasElementDescription returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElement) HasElementDescription() bool { + return o != nil && o.ElementDescription != nil +} + +// SetElementDescription gets a reference to the given string and assigns it to the ElementDescription field. +func (o *SyntheticsMobileStepParamsElement) SetElementDescription(v string) { + o.ElementDescription = &v +} + +// GetMultiLocator returns the MultiLocator field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElement) GetMultiLocator() interface{} { + if o == nil || o.MultiLocator == nil { + var ret interface{} + return ret + } + return o.MultiLocator +} + +// GetMultiLocatorOk returns a tuple with the MultiLocator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElement) GetMultiLocatorOk() (*interface{}, bool) { + if o == nil || o.MultiLocator == nil { + return nil, false + } + return &o.MultiLocator, true +} + +// HasMultiLocator returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElement) HasMultiLocator() bool { + return o != nil && o.MultiLocator != nil +} + +// SetMultiLocator gets a reference to the given interface{} and assigns it to the MultiLocator field. +func (o *SyntheticsMobileStepParamsElement) SetMultiLocator(v interface{}) { + o.MultiLocator = v +} + +// GetRelativePosition returns the RelativePosition field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElement) GetRelativePosition() SyntheticsMobileStepParamsElementRelativePosition { + if o == nil || o.RelativePosition == nil { + var ret SyntheticsMobileStepParamsElementRelativePosition + return ret + } + return *o.RelativePosition +} + +// GetRelativePositionOk returns a tuple with the RelativePosition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElement) GetRelativePositionOk() (*SyntheticsMobileStepParamsElementRelativePosition, bool) { + if o == nil || o.RelativePosition == nil { + return nil, false + } + return o.RelativePosition, true +} + +// HasRelativePosition returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElement) HasRelativePosition() bool { + return o != nil && o.RelativePosition != nil +} + +// SetRelativePosition gets a reference to the given SyntheticsMobileStepParamsElementRelativePosition and assigns it to the RelativePosition field. +func (o *SyntheticsMobileStepParamsElement) SetRelativePosition(v SyntheticsMobileStepParamsElementRelativePosition) { + o.RelativePosition = &v +} + +// GetTextContent returns the TextContent field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElement) GetTextContent() string { + if o == nil || o.TextContent == nil { + var ret string + return ret + } + return *o.TextContent +} + +// GetTextContentOk returns a tuple with the TextContent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElement) GetTextContentOk() (*string, bool) { + if o == nil || o.TextContent == nil { + return nil, false + } + return o.TextContent, true +} + +// HasTextContent returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElement) HasTextContent() bool { + return o != nil && o.TextContent != nil +} + +// SetTextContent gets a reference to the given string and assigns it to the TextContent field. +func (o *SyntheticsMobileStepParamsElement) SetTextContent(v string) { + o.TextContent = &v +} + +// GetUserLocator returns the UserLocator field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElement) GetUserLocator() SyntheticsMobileStepParamsElementUserLocator { + if o == nil || o.UserLocator == nil { + var ret SyntheticsMobileStepParamsElementUserLocator + return ret + } + return *o.UserLocator +} + +// GetUserLocatorOk returns a tuple with the UserLocator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElement) GetUserLocatorOk() (*SyntheticsMobileStepParamsElementUserLocator, bool) { + if o == nil || o.UserLocator == nil { + return nil, false + } + return o.UserLocator, true +} + +// HasUserLocator returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElement) HasUserLocator() bool { + return o != nil && o.UserLocator != nil +} + +// SetUserLocator gets a reference to the given SyntheticsMobileStepParamsElementUserLocator and assigns it to the UserLocator field. +func (o *SyntheticsMobileStepParamsElement) SetUserLocator(v SyntheticsMobileStepParamsElementUserLocator) { + o.UserLocator = &v +} + +// GetViewName returns the ViewName field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElement) GetViewName() string { + if o == nil || o.ViewName == nil { + var ret string + return ret + } + return *o.ViewName +} + +// GetViewNameOk returns a tuple with the ViewName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElement) GetViewNameOk() (*string, bool) { + if o == nil || o.ViewName == nil { + return nil, false + } + return o.ViewName, true +} + +// HasViewName returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElement) HasViewName() bool { + return o != nil && o.ViewName != nil +} + +// SetViewName gets a reference to the given string and assigns it to the ViewName field. +func (o *SyntheticsMobileStepParamsElement) SetViewName(v string) { + o.ViewName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsMobileStepParamsElement) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Context != nil { + toSerialize["context"] = o.Context + } + if o.ContextType != nil { + toSerialize["contextType"] = o.ContextType + } + if o.ElementDescription != nil { + toSerialize["elementDescription"] = o.ElementDescription + } + if o.MultiLocator != nil { + toSerialize["multiLocator"] = o.MultiLocator + } + if o.RelativePosition != nil { + toSerialize["relativePosition"] = o.RelativePosition + } + if o.TextContent != nil { + toSerialize["textContent"] = o.TextContent + } + if o.UserLocator != nil { + toSerialize["userLocator"] = o.UserLocator + } + if o.ViewName != nil { + toSerialize["viewName"] = o.ViewName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsMobileStepParamsElement) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Context *string `json:"context,omitempty"` + ContextType *SyntheticsMobileStepParamsElementContextType `json:"contextType,omitempty"` + ElementDescription *string `json:"elementDescription,omitempty"` + MultiLocator interface{} `json:"multiLocator,omitempty"` + RelativePosition *SyntheticsMobileStepParamsElementRelativePosition `json:"relativePosition,omitempty"` + TextContent *string `json:"textContent,omitempty"` + UserLocator *SyntheticsMobileStepParamsElementUserLocator `json:"userLocator,omitempty"` + ViewName *string `json:"viewName,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{"context", "contextType", "elementDescription", "multiLocator", "relativePosition", "textContent", "userLocator", "viewName"}) + } else { + return err + } + + hasInvalidField := false + o.Context = all.Context + if all.ContextType != nil && !all.ContextType.IsValid() { + hasInvalidField = true + } else { + o.ContextType = all.ContextType + } + o.ElementDescription = all.ElementDescription + o.MultiLocator = all.MultiLocator + if all.RelativePosition != nil && all.RelativePosition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.RelativePosition = all.RelativePosition + o.TextContent = all.TextContent + if all.UserLocator != nil && all.UserLocator.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.UserLocator = all.UserLocator + o.ViewName = all.ViewName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV1/model_synthetics_mobile_step_params_element_context_type.go b/api/datadogV1/model_synthetics_mobile_step_params_element_context_type.go new file mode 100644 index 00000000000..76939779929 --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params_element_context_type.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParamsElementContextType Type of the context that the element is in. +type SyntheticsMobileStepParamsElementContextType string + +// List of SyntheticsMobileStepParamsElementContextType. +const ( + SYNTHETICSMOBILESTEPPARAMSELEMENTCONTEXTTYPE_NATIVE SyntheticsMobileStepParamsElementContextType = "native" + SYNTHETICSMOBILESTEPPARAMSELEMENTCONTEXTTYPE_WEB SyntheticsMobileStepParamsElementContextType = "web" +) + +var allowedSyntheticsMobileStepParamsElementContextTypeEnumValues = []SyntheticsMobileStepParamsElementContextType{ + SYNTHETICSMOBILESTEPPARAMSELEMENTCONTEXTTYPE_NATIVE, + SYNTHETICSMOBILESTEPPARAMSELEMENTCONTEXTTYPE_WEB, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsMobileStepParamsElementContextType) GetAllowedValues() []SyntheticsMobileStepParamsElementContextType { + return allowedSyntheticsMobileStepParamsElementContextTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsMobileStepParamsElementContextType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsMobileStepParamsElementContextType(value) + return nil +} + +// NewSyntheticsMobileStepParamsElementContextTypeFromValue returns a pointer to a valid SyntheticsMobileStepParamsElementContextType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsMobileStepParamsElementContextTypeFromValue(v string) (*SyntheticsMobileStepParamsElementContextType, error) { + ev := SyntheticsMobileStepParamsElementContextType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsMobileStepParamsElementContextType: valid values are %v", v, allowedSyntheticsMobileStepParamsElementContextTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsMobileStepParamsElementContextType) IsValid() bool { + for _, existing := range allowedSyntheticsMobileStepParamsElementContextTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsMobileStepParamsElementContextType value. +func (v SyntheticsMobileStepParamsElementContextType) Ptr() *SyntheticsMobileStepParamsElementContextType { + return &v +} diff --git a/api/datadogV1/model_synthetics_mobile_step_params_element_relative_position.go b/api/datadogV1/model_synthetics_mobile_step_params_element_relative_position.go new file mode 100644 index 00000000000..66a96a73d52 --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params_element_relative_position.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParamsElementRelativePosition Position of the action relative to the element. +type SyntheticsMobileStepParamsElementRelativePosition struct { + // The `relativePosition` on the `x` axis for the element. + X *int64 `json:"x,omitempty"` + // The `relativePosition` on the `y` axis for the element. + Y *int64 `json:"y,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSyntheticsMobileStepParamsElementRelativePosition instantiates a new SyntheticsMobileStepParamsElementRelativePosition object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSyntheticsMobileStepParamsElementRelativePosition() *SyntheticsMobileStepParamsElementRelativePosition { + this := SyntheticsMobileStepParamsElementRelativePosition{} + return &this +} + +// NewSyntheticsMobileStepParamsElementRelativePositionWithDefaults instantiates a new SyntheticsMobileStepParamsElementRelativePosition object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSyntheticsMobileStepParamsElementRelativePositionWithDefaults() *SyntheticsMobileStepParamsElementRelativePosition { + this := SyntheticsMobileStepParamsElementRelativePosition{} + return &this +} + +// GetX returns the X field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElementRelativePosition) GetX() int64 { + if o == nil || o.X == nil { + var ret int64 + return ret + } + return *o.X +} + +// GetXOk returns a tuple with the X field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElementRelativePosition) GetXOk() (*int64, bool) { + if o == nil || o.X == nil { + return nil, false + } + return o.X, true +} + +// HasX returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElementRelativePosition) HasX() bool { + return o != nil && o.X != nil +} + +// SetX gets a reference to the given int64 and assigns it to the X field. +func (o *SyntheticsMobileStepParamsElementRelativePosition) SetX(v int64) { + o.X = &v +} + +// GetY returns the Y field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElementRelativePosition) GetY() int64 { + if o == nil || o.Y == nil { + var ret int64 + return ret + } + return *o.Y +} + +// GetYOk returns a tuple with the Y field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElementRelativePosition) GetYOk() (*int64, bool) { + if o == nil || o.Y == nil { + return nil, false + } + return o.Y, true +} + +// HasY returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElementRelativePosition) HasY() bool { + return o != nil && o.Y != nil +} + +// SetY gets a reference to the given int64 and assigns it to the Y field. +func (o *SyntheticsMobileStepParamsElementRelativePosition) SetY(v int64) { + o.Y = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsMobileStepParamsElementRelativePosition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.X != nil { + toSerialize["x"] = o.X + } + if o.Y != nil { + toSerialize["y"] = o.Y + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsMobileStepParamsElementRelativePosition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + X *int64 `json:"x,omitempty"` + Y *int64 `json:"y,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{"x", "y"}) + } else { + return err + } + o.X = all.X + o.Y = all.Y + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV1/model_synthetics_mobile_step_params_element_user_locator.go b/api/datadogV1/model_synthetics_mobile_step_params_element_user_locator.go new file mode 100644 index 00000000000..868dce24566 --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params_element_user_locator.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParamsElementUserLocator User locator to find the element. +type SyntheticsMobileStepParamsElementUserLocator struct { + // Whether if the the test should fail if the element cannot be found. + FailTestOnCannotLocate *bool `json:"failTestOnCannotLocate,omitempty"` + // Values of the user locator. + Values []SyntheticsMobileStepParamsElementUserLocatorValuesItems `json:"values,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSyntheticsMobileStepParamsElementUserLocator instantiates a new SyntheticsMobileStepParamsElementUserLocator object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSyntheticsMobileStepParamsElementUserLocator() *SyntheticsMobileStepParamsElementUserLocator { + this := SyntheticsMobileStepParamsElementUserLocator{} + return &this +} + +// NewSyntheticsMobileStepParamsElementUserLocatorWithDefaults instantiates a new SyntheticsMobileStepParamsElementUserLocator object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSyntheticsMobileStepParamsElementUserLocatorWithDefaults() *SyntheticsMobileStepParamsElementUserLocator { + this := SyntheticsMobileStepParamsElementUserLocator{} + return &this +} + +// GetFailTestOnCannotLocate returns the FailTestOnCannotLocate field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElementUserLocator) GetFailTestOnCannotLocate() bool { + if o == nil || o.FailTestOnCannotLocate == nil { + var ret bool + return ret + } + return *o.FailTestOnCannotLocate +} + +// GetFailTestOnCannotLocateOk returns a tuple with the FailTestOnCannotLocate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElementUserLocator) GetFailTestOnCannotLocateOk() (*bool, bool) { + if o == nil || o.FailTestOnCannotLocate == nil { + return nil, false + } + return o.FailTestOnCannotLocate, true +} + +// HasFailTestOnCannotLocate returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElementUserLocator) HasFailTestOnCannotLocate() bool { + return o != nil && o.FailTestOnCannotLocate != nil +} + +// SetFailTestOnCannotLocate gets a reference to the given bool and assigns it to the FailTestOnCannotLocate field. +func (o *SyntheticsMobileStepParamsElementUserLocator) SetFailTestOnCannotLocate(v bool) { + o.FailTestOnCannotLocate = &v +} + +// GetValues returns the Values field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElementUserLocator) GetValues() []SyntheticsMobileStepParamsElementUserLocatorValuesItems { + if o == nil || o.Values == nil { + var ret []SyntheticsMobileStepParamsElementUserLocatorValuesItems + return ret + } + return o.Values +} + +// GetValuesOk returns a tuple with the Values field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElementUserLocator) GetValuesOk() (*[]SyntheticsMobileStepParamsElementUserLocatorValuesItems, bool) { + if o == nil || o.Values == nil { + return nil, false + } + return &o.Values, true +} + +// HasValues returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElementUserLocator) HasValues() bool { + return o != nil && o.Values != nil +} + +// SetValues gets a reference to the given []SyntheticsMobileStepParamsElementUserLocatorValuesItems and assigns it to the Values field. +func (o *SyntheticsMobileStepParamsElementUserLocator) SetValues(v []SyntheticsMobileStepParamsElementUserLocatorValuesItems) { + o.Values = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsMobileStepParamsElementUserLocator) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.FailTestOnCannotLocate != nil { + toSerialize["failTestOnCannotLocate"] = o.FailTestOnCannotLocate + } + if o.Values != nil { + toSerialize["values"] = o.Values + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsMobileStepParamsElementUserLocator) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + FailTestOnCannotLocate *bool `json:"failTestOnCannotLocate,omitempty"` + Values []SyntheticsMobileStepParamsElementUserLocatorValuesItems `json:"values,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{"failTestOnCannotLocate", "values"}) + } else { + return err + } + o.FailTestOnCannotLocate = all.FailTestOnCannotLocate + o.Values = all.Values + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV1/model_synthetics_mobile_step_params_element_user_locator_values_items.go b/api/datadogV1/model_synthetics_mobile_step_params_element_user_locator_values_items.go new file mode 100644 index 00000000000..4f70eac9160 --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params_element_user_locator_values_items.go @@ -0,0 +1,147 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParamsElementUserLocatorValuesItems A single user locator object. +type SyntheticsMobileStepParamsElementUserLocatorValuesItems struct { + // Type of a user locator. + Type *SyntheticsMobileStepParamsElementUserLocatorValuesItemsType `json:"type,omitempty"` + // Value of a user locator. + Value *string `json:"value,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSyntheticsMobileStepParamsElementUserLocatorValuesItems instantiates a new SyntheticsMobileStepParamsElementUserLocatorValuesItems object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSyntheticsMobileStepParamsElementUserLocatorValuesItems() *SyntheticsMobileStepParamsElementUserLocatorValuesItems { + this := SyntheticsMobileStepParamsElementUserLocatorValuesItems{} + return &this +} + +// NewSyntheticsMobileStepParamsElementUserLocatorValuesItemsWithDefaults instantiates a new SyntheticsMobileStepParamsElementUserLocatorValuesItems object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSyntheticsMobileStepParamsElementUserLocatorValuesItemsWithDefaults() *SyntheticsMobileStepParamsElementUserLocatorValuesItems { + this := SyntheticsMobileStepParamsElementUserLocatorValuesItems{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElementUserLocatorValuesItems) GetType() SyntheticsMobileStepParamsElementUserLocatorValuesItemsType { + if o == nil || o.Type == nil { + var ret SyntheticsMobileStepParamsElementUserLocatorValuesItemsType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElementUserLocatorValuesItems) GetTypeOk() (*SyntheticsMobileStepParamsElementUserLocatorValuesItemsType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElementUserLocatorValuesItems) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SyntheticsMobileStepParamsElementUserLocatorValuesItemsType and assigns it to the Type field. +func (o *SyntheticsMobileStepParamsElementUserLocatorValuesItems) SetType(v SyntheticsMobileStepParamsElementUserLocatorValuesItemsType) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsElementUserLocatorValuesItems) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsElementUserLocatorValuesItems) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsElementUserLocatorValuesItems) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *SyntheticsMobileStepParamsElementUserLocatorValuesItems) SetValue(v string) { + o.Value = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsMobileStepParamsElementUserLocatorValuesItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsMobileStepParamsElementUserLocatorValuesItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Type *SyntheticsMobileStepParamsElementUserLocatorValuesItemsType `json:"type,omitempty"` + Value *string `json:"value,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{"type", "value"}) + } else { + return err + } + + hasInvalidField := false + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV1/model_synthetics_mobile_step_params_element_user_locator_values_items_type.go b/api/datadogV1/model_synthetics_mobile_step_params_element_user_locator_values_items_type.go new file mode 100644 index 00000000000..141c975cd9c --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params_element_user_locator_values_items_type.go @@ -0,0 +1,72 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParamsElementUserLocatorValuesItemsType Type of a user locator. +type SyntheticsMobileStepParamsElementUserLocatorValuesItemsType string + +// List of SyntheticsMobileStepParamsElementUserLocatorValuesItemsType. +const ( + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_ACCESSIBILITY_ID SyntheticsMobileStepParamsElementUserLocatorValuesItemsType = "accessibility-id" + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_ID SyntheticsMobileStepParamsElementUserLocatorValuesItemsType = "id" + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_IOS_PREDICATE_STRING SyntheticsMobileStepParamsElementUserLocatorValuesItemsType = "ios-predicate-string" + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_IOS_CLASS_CHAIN SyntheticsMobileStepParamsElementUserLocatorValuesItemsType = "ios-class-chain" + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_XPATH SyntheticsMobileStepParamsElementUserLocatorValuesItemsType = "xpath" +) + +var allowedSyntheticsMobileStepParamsElementUserLocatorValuesItemsTypeEnumValues = []SyntheticsMobileStepParamsElementUserLocatorValuesItemsType{ + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_ACCESSIBILITY_ID, + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_ID, + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_IOS_PREDICATE_STRING, + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_IOS_CLASS_CHAIN, + SYNTHETICSMOBILESTEPPARAMSELEMENTUSERLOCATORVALUESITEMSTYPE_XPATH, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsMobileStepParamsElementUserLocatorValuesItemsType) GetAllowedValues() []SyntheticsMobileStepParamsElementUserLocatorValuesItemsType { + return allowedSyntheticsMobileStepParamsElementUserLocatorValuesItemsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsMobileStepParamsElementUserLocatorValuesItemsType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsMobileStepParamsElementUserLocatorValuesItemsType(value) + return nil +} + +// NewSyntheticsMobileStepParamsElementUserLocatorValuesItemsTypeFromValue returns a pointer to a valid SyntheticsMobileStepParamsElementUserLocatorValuesItemsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsMobileStepParamsElementUserLocatorValuesItemsTypeFromValue(v string) (*SyntheticsMobileStepParamsElementUserLocatorValuesItemsType, error) { + ev := SyntheticsMobileStepParamsElementUserLocatorValuesItemsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsMobileStepParamsElementUserLocatorValuesItemsType: valid values are %v", v, allowedSyntheticsMobileStepParamsElementUserLocatorValuesItemsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsMobileStepParamsElementUserLocatorValuesItemsType) IsValid() bool { + for _, existing := range allowedSyntheticsMobileStepParamsElementUserLocatorValuesItemsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsMobileStepParamsElementUserLocatorValuesItemsType value. +func (v SyntheticsMobileStepParamsElementUserLocatorValuesItemsType) Ptr() *SyntheticsMobileStepParamsElementUserLocatorValuesItemsType { + return &v +} diff --git a/api/datadogV1/model_synthetics_mobile_step_params_positions_items.go b/api/datadogV1/model_synthetics_mobile_step_params_positions_items.go new file mode 100644 index 00000000000..374e9d44526 --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params_positions_items.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParamsPositionsItems A description of a single position for a `flick` step type. +type SyntheticsMobileStepParamsPositionsItems struct { + // The `x` position for the flick. + X *int64 `json:"x,omitempty"` + // The `y` position for the flick. + Y *int64 `json:"y,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSyntheticsMobileStepParamsPositionsItems instantiates a new SyntheticsMobileStepParamsPositionsItems object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSyntheticsMobileStepParamsPositionsItems() *SyntheticsMobileStepParamsPositionsItems { + this := SyntheticsMobileStepParamsPositionsItems{} + return &this +} + +// NewSyntheticsMobileStepParamsPositionsItemsWithDefaults instantiates a new SyntheticsMobileStepParamsPositionsItems object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSyntheticsMobileStepParamsPositionsItemsWithDefaults() *SyntheticsMobileStepParamsPositionsItems { + this := SyntheticsMobileStepParamsPositionsItems{} + return &this +} + +// GetX returns the X field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsPositionsItems) GetX() int64 { + if o == nil || o.X == nil { + var ret int64 + return ret + } + return *o.X +} + +// GetXOk returns a tuple with the X field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsPositionsItems) GetXOk() (*int64, bool) { + if o == nil || o.X == nil { + return nil, false + } + return o.X, true +} + +// HasX returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsPositionsItems) HasX() bool { + return o != nil && o.X != nil +} + +// SetX gets a reference to the given int64 and assigns it to the X field. +func (o *SyntheticsMobileStepParamsPositionsItems) SetX(v int64) { + o.X = &v +} + +// GetY returns the Y field value if set, zero value otherwise. +func (o *SyntheticsMobileStepParamsPositionsItems) GetY() int64 { + if o == nil || o.Y == nil { + var ret int64 + return ret + } + return *o.Y +} + +// GetYOk returns a tuple with the Y field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsPositionsItems) GetYOk() (*int64, bool) { + if o == nil || o.Y == nil { + return nil, false + } + return o.Y, true +} + +// HasY returns a boolean if a field has been set. +func (o *SyntheticsMobileStepParamsPositionsItems) HasY() bool { + return o != nil && o.Y != nil +} + +// SetY gets a reference to the given int64 and assigns it to the Y field. +func (o *SyntheticsMobileStepParamsPositionsItems) SetY(v int64) { + o.Y = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsMobileStepParamsPositionsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.X != nil { + toSerialize["x"] = o.X + } + if o.Y != nil { + toSerialize["y"] = o.Y + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsMobileStepParamsPositionsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + X *int64 `json:"x,omitempty"` + Y *int64 `json:"y,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{"x", "y"}) + } else { + return err + } + o.X = all.X + o.Y = all.Y + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV1/model_synthetics_mobile_step_params_variable.go b/api/datadogV1/model_synthetics_mobile_step_params_variable.go new file mode 100644 index 00000000000..9d33416e445 --- /dev/null +++ b/api/datadogV1/model_synthetics_mobile_step_params_variable.go @@ -0,0 +1,133 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsMobileStepParamsVariable Variable object for `extractVariable` step type. +type SyntheticsMobileStepParamsVariable struct { + // An example for the variable. + Example string `json:"example"` + // The variable name. + Name string `json:"name"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSyntheticsMobileStepParamsVariable instantiates a new SyntheticsMobileStepParamsVariable object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSyntheticsMobileStepParamsVariable(example string, name string) *SyntheticsMobileStepParamsVariable { + this := SyntheticsMobileStepParamsVariable{} + this.Example = example + this.Name = name + return &this +} + +// NewSyntheticsMobileStepParamsVariableWithDefaults instantiates a new SyntheticsMobileStepParamsVariable object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSyntheticsMobileStepParamsVariableWithDefaults() *SyntheticsMobileStepParamsVariable { + this := SyntheticsMobileStepParamsVariable{} + return &this +} + +// GetExample returns the Example field value. +func (o *SyntheticsMobileStepParamsVariable) GetExample() string { + if o == nil { + var ret string + return ret + } + return o.Example +} + +// GetExampleOk returns a tuple with the Example field value +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsVariable) GetExampleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Example, true +} + +// SetExample sets field value. +func (o *SyntheticsMobileStepParamsVariable) SetExample(v string) { + o.Example = v +} + +// GetName returns the Name field value. +func (o *SyntheticsMobileStepParamsVariable) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SyntheticsMobileStepParamsVariable) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SyntheticsMobileStepParamsVariable) SetName(v string) { + o.Name = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsMobileStepParamsVariable) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["example"] = o.Example + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsMobileStepParamsVariable) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Example *string `json:"example"` + Name *string `json:"name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Example == nil { + return fmt.Errorf("required field example missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"example", "name"}) + } else { + return err + } + o.Example = *all.Example + o.Name = *all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV1/model_synthetics_mobile_test_.go b/api/datadogV1/model_synthetics_mobile_test_.go index 7b2d6607ce1..8f3e9f0abe9 100644 --- a/api/datadogV1/model_synthetics_mobile_test_.go +++ b/api/datadogV1/model_synthetics_mobile_test_.go @@ -14,7 +14,7 @@ import ( type SyntheticsMobileTest struct { // Configuration object for a Synthetic mobile test. Config SyntheticsMobileTestConfig `json:"config"` - // The `SyntheticsMobileTest` `device_ids`. + // Array with the different device IDs used to run the test. DeviceIds []string `json:"device_ids,omitempty"` // Notification message associated with the test. Message *string `json:"message,omitempty"` diff --git a/api/datadogV1/model_synthetics_mobile_test_binding.go b/api/datadogV1/model_synthetics_mobile_test_binding.go deleted file mode 100644 index dd2e3032dd6..00000000000 --- a/api/datadogV1/model_synthetics_mobile_test_binding.go +++ /dev/null @@ -1,111 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV1 - -import ( - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// SyntheticsMobileTestBinding Objects describing the binding used for a mobile test. -type SyntheticsMobileTestBinding struct { - // Object describing the binding used for a mobile test. - Items *SyntheticsMobileTestBindingItems `json:"items,omitempty"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// NewSyntheticsMobileTestBinding instantiates a new SyntheticsMobileTestBinding object. -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewSyntheticsMobileTestBinding() *SyntheticsMobileTestBinding { - this := SyntheticsMobileTestBinding{} - return &this -} - -// NewSyntheticsMobileTestBindingWithDefaults instantiates a new SyntheticsMobileTestBinding object. -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set. -func NewSyntheticsMobileTestBindingWithDefaults() *SyntheticsMobileTestBinding { - this := SyntheticsMobileTestBinding{} - return &this -} - -// GetItems returns the Items field value if set, zero value otherwise. -func (o *SyntheticsMobileTestBinding) GetItems() SyntheticsMobileTestBindingItems { - if o == nil || o.Items == nil { - var ret SyntheticsMobileTestBindingItems - return ret - } - return *o.Items -} - -// GetItemsOk returns a tuple with the Items field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestBinding) GetItemsOk() (*SyntheticsMobileTestBindingItems, bool) { - if o == nil || o.Items == nil { - return nil, false - } - return o.Items, true -} - -// HasItems returns a boolean if a field has been set. -func (o *SyntheticsMobileTestBinding) HasItems() bool { - return o != nil && o.Items != nil -} - -// SetItems gets a reference to the given SyntheticsMobileTestBindingItems and assigns it to the Items field. -func (o *SyntheticsMobileTestBinding) SetItems(v SyntheticsMobileTestBindingItems) { - o.Items = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsMobileTestBinding) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.Items != nil { - toSerialize["items"] = o.Items - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsMobileTestBinding) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Items *SyntheticsMobileTestBindingItems `json:"items,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{"items"}) - } else { - return err - } - - hasInvalidField := false - if all.Items != nil && all.Items.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Items = all.Items - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV1/model_synthetics_mobile_test_binding_items_role.go b/api/datadogV1/model_synthetics_mobile_test_binding_items_role.go deleted file mode 100644 index e32f120c02f..00000000000 --- a/api/datadogV1/model_synthetics_mobile_test_binding_items_role.go +++ /dev/null @@ -1,66 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV1 - -import ( - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// SyntheticsMobileTestBindingItemsRole The definition of `SyntheticsMobileTestBindingItemsRole` object. -type SyntheticsMobileTestBindingItemsRole string - -// List of SyntheticsMobileTestBindingItemsRole. -const ( - SYNTHETICSMOBILETESTBINDINGITEMSROLE_EDITOR SyntheticsMobileTestBindingItemsRole = "editor" - SYNTHETICSMOBILETESTBINDINGITEMSROLE_VIEWER SyntheticsMobileTestBindingItemsRole = "viewer" -) - -var allowedSyntheticsMobileTestBindingItemsRoleEnumValues = []SyntheticsMobileTestBindingItemsRole{ - SYNTHETICSMOBILETESTBINDINGITEMSROLE_EDITOR, - SYNTHETICSMOBILETESTBINDINGITEMSROLE_VIEWER, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsMobileTestBindingItemsRole) GetAllowedValues() []SyntheticsMobileTestBindingItemsRole { - return allowedSyntheticsMobileTestBindingItemsRoleEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsMobileTestBindingItemsRole) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsMobileTestBindingItemsRole(value) - return nil -} - -// NewSyntheticsMobileTestBindingItemsRoleFromValue returns a pointer to a valid SyntheticsMobileTestBindingItemsRole -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsMobileTestBindingItemsRoleFromValue(v string) (*SyntheticsMobileTestBindingItemsRole, error) { - ev := SyntheticsMobileTestBindingItemsRole(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsMobileTestBindingItemsRole: valid values are %v", v, allowedSyntheticsMobileTestBindingItemsRoleEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsMobileTestBindingItemsRole) IsValid() bool { - for _, existing := range allowedSyntheticsMobileTestBindingItemsRoleEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsMobileTestBindingItemsRole value. -func (v SyntheticsMobileTestBindingItemsRole) Ptr() *SyntheticsMobileTestBindingItemsRole { - return &v -} diff --git a/api/datadogV1/model_synthetics_mobile_test_ci_options.go b/api/datadogV1/model_synthetics_mobile_test_ci_options.go deleted file mode 100644 index ee68fe3bd51..00000000000 --- a/api/datadogV1/model_synthetics_mobile_test_ci_options.go +++ /dev/null @@ -1,111 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV1 - -import ( - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// SyntheticsMobileTestCiOptions CI/CD options for a Synthetic test. -type SyntheticsMobileTestCiOptions struct { - // Execution rule for a Synthetic test. - ExecutionRule SyntheticsTestExecutionRule `json:"executionRule"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// NewSyntheticsMobileTestCiOptions instantiates a new SyntheticsMobileTestCiOptions object. -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewSyntheticsMobileTestCiOptions(executionRule SyntheticsTestExecutionRule) *SyntheticsMobileTestCiOptions { - this := SyntheticsMobileTestCiOptions{} - this.ExecutionRule = executionRule - return &this -} - -// NewSyntheticsMobileTestCiOptionsWithDefaults instantiates a new SyntheticsMobileTestCiOptions object. -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set. -func NewSyntheticsMobileTestCiOptionsWithDefaults() *SyntheticsMobileTestCiOptions { - this := SyntheticsMobileTestCiOptions{} - return &this -} - -// GetExecutionRule returns the ExecutionRule field value. -func (o *SyntheticsMobileTestCiOptions) GetExecutionRule() SyntheticsTestExecutionRule { - if o == nil { - var ret SyntheticsTestExecutionRule - return ret - } - return o.ExecutionRule -} - -// GetExecutionRuleOk returns a tuple with the ExecutionRule field value -// and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestCiOptions) GetExecutionRuleOk() (*SyntheticsTestExecutionRule, bool) { - if o == nil { - return nil, false - } - return &o.ExecutionRule, true -} - -// SetExecutionRule sets field value. -func (o *SyntheticsMobileTestCiOptions) SetExecutionRule(v SyntheticsTestExecutionRule) { - o.ExecutionRule = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsMobileTestCiOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["executionRule"] = o.ExecutionRule - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsMobileTestCiOptions) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.ExecutionRule == nil { - return fmt.Errorf("required field executionRule missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"executionRule"}) - } else { - return err - } - - hasInvalidField := false - if !all.ExecutionRule.IsValid() { - hasInvalidField = true - } else { - o.ExecutionRule = *all.ExecutionRule - } - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV1/model_synthetics_mobile_test_config.go b/api/datadogV1/model_synthetics_mobile_test_config.go index 806db6c3796..0eb51bd274d 100644 --- a/api/datadogV1/model_synthetics_mobile_test_config.go +++ b/api/datadogV1/model_synthetics_mobile_test_config.go @@ -11,7 +11,7 @@ import ( // SyntheticsMobileTestConfig Configuration object for a Synthetic mobile test. type SyntheticsMobileTestConfig struct { // Initial application arguments for a mobile test. - InitialApplicationArguments *SyntheticsMobileTestInitialApplicationArguments `json:"initialApplicationArguments,omitempty"` + InitialApplicationArguments map[string]string `json:"initialApplicationArguments,omitempty"` // Array of variables used for the test steps. Variables []SyntheticsConfigVariable `json:"variables,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -37,21 +37,21 @@ func NewSyntheticsMobileTestConfigWithDefaults() *SyntheticsMobileTestConfig { } // GetInitialApplicationArguments returns the InitialApplicationArguments field value if set, zero value otherwise. -func (o *SyntheticsMobileTestConfig) GetInitialApplicationArguments() SyntheticsMobileTestInitialApplicationArguments { +func (o *SyntheticsMobileTestConfig) GetInitialApplicationArguments() map[string]string { if o == nil || o.InitialApplicationArguments == nil { - var ret SyntheticsMobileTestInitialApplicationArguments + var ret map[string]string return ret } - return *o.InitialApplicationArguments + return o.InitialApplicationArguments } // GetInitialApplicationArgumentsOk returns a tuple with the InitialApplicationArguments field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestConfig) GetInitialApplicationArgumentsOk() (*SyntheticsMobileTestInitialApplicationArguments, bool) { +func (o *SyntheticsMobileTestConfig) GetInitialApplicationArgumentsOk() (*map[string]string, bool) { if o == nil || o.InitialApplicationArguments == nil { return nil, false } - return o.InitialApplicationArguments, true + return &o.InitialApplicationArguments, true } // HasInitialApplicationArguments returns a boolean if a field has been set. @@ -59,9 +59,9 @@ func (o *SyntheticsMobileTestConfig) HasInitialApplicationArguments() bool { return o != nil && o.InitialApplicationArguments != nil } -// SetInitialApplicationArguments gets a reference to the given SyntheticsMobileTestInitialApplicationArguments and assigns it to the InitialApplicationArguments field. -func (o *SyntheticsMobileTestConfig) SetInitialApplicationArguments(v SyntheticsMobileTestInitialApplicationArguments) { - o.InitialApplicationArguments = &v +// SetInitialApplicationArguments gets a reference to the given map[string]string and assigns it to the InitialApplicationArguments field. +func (o *SyntheticsMobileTestConfig) SetInitialApplicationArguments(v map[string]string) { + o.InitialApplicationArguments = v } // GetVariables returns the Variables field value if set, zero value otherwise. @@ -114,8 +114,8 @@ func (o SyntheticsMobileTestConfig) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsMobileTestConfig) UnmarshalJSON(bytes []byte) (err error) { all := struct { - InitialApplicationArguments *SyntheticsMobileTestInitialApplicationArguments `json:"initialApplicationArguments,omitempty"` - Variables []SyntheticsConfigVariable `json:"variables,omitempty"` + InitialApplicationArguments map[string]string `json:"initialApplicationArguments,omitempty"` + Variables []SyntheticsConfigVariable `json:"variables,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -126,11 +126,6 @@ func (o *SyntheticsMobileTestConfig) UnmarshalJSON(bytes []byte) (err error) { } else { return err } - - hasInvalidField := false - if all.InitialApplicationArguments != nil && all.InitialApplicationArguments.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } o.InitialApplicationArguments = all.InitialApplicationArguments o.Variables = all.Variables @@ -138,9 +133,5 @@ func (o *SyntheticsMobileTestConfig) UnmarshalJSON(bytes []byte) (err error) { o.AdditionalProperties = additionalProperties } - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - return nil } diff --git a/api/datadogV1/model_synthetics_mobile_test_initial_application_arguments.go b/api/datadogV1/model_synthetics_mobile_test_initial_application_arguments.go deleted file mode 100644 index c6997606eb6..00000000000 --- a/api/datadogV1/model_synthetics_mobile_test_initial_application_arguments.go +++ /dev/null @@ -1,111 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV1 - -import ( - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// SyntheticsMobileTestInitialApplicationArguments Initial application arguments for a mobile test. -type SyntheticsMobileTestInitialApplicationArguments struct { - // Name of the property. - PropertyNames *SyntheticsMobileTestInitialApplicationArgumentsPropertyNames `json:"propertyNames,omitempty"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// NewSyntheticsMobileTestInitialApplicationArguments instantiates a new SyntheticsMobileTestInitialApplicationArguments object. -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewSyntheticsMobileTestInitialApplicationArguments() *SyntheticsMobileTestInitialApplicationArguments { - this := SyntheticsMobileTestInitialApplicationArguments{} - return &this -} - -// NewSyntheticsMobileTestInitialApplicationArgumentsWithDefaults instantiates a new SyntheticsMobileTestInitialApplicationArguments object. -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set. -func NewSyntheticsMobileTestInitialApplicationArgumentsWithDefaults() *SyntheticsMobileTestInitialApplicationArguments { - this := SyntheticsMobileTestInitialApplicationArguments{} - return &this -} - -// GetPropertyNames returns the PropertyNames field value if set, zero value otherwise. -func (o *SyntheticsMobileTestInitialApplicationArguments) GetPropertyNames() SyntheticsMobileTestInitialApplicationArgumentsPropertyNames { - if o == nil || o.PropertyNames == nil { - var ret SyntheticsMobileTestInitialApplicationArgumentsPropertyNames - return ret - } - return *o.PropertyNames -} - -// GetPropertyNamesOk returns a tuple with the PropertyNames field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestInitialApplicationArguments) GetPropertyNamesOk() (*SyntheticsMobileTestInitialApplicationArgumentsPropertyNames, bool) { - if o == nil || o.PropertyNames == nil { - return nil, false - } - return o.PropertyNames, true -} - -// HasPropertyNames returns a boolean if a field has been set. -func (o *SyntheticsMobileTestInitialApplicationArguments) HasPropertyNames() bool { - return o != nil && o.PropertyNames != nil -} - -// SetPropertyNames gets a reference to the given SyntheticsMobileTestInitialApplicationArgumentsPropertyNames and assigns it to the PropertyNames field. -func (o *SyntheticsMobileTestInitialApplicationArguments) SetPropertyNames(v SyntheticsMobileTestInitialApplicationArgumentsPropertyNames) { - o.PropertyNames = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsMobileTestInitialApplicationArguments) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.PropertyNames != nil { - toSerialize["propertyNames"] = o.PropertyNames - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsMobileTestInitialApplicationArguments) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - PropertyNames *SyntheticsMobileTestInitialApplicationArgumentsPropertyNames `json:"propertyNames,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{"propertyNames"}) - } else { - return err - } - - hasInvalidField := false - if all.PropertyNames != nil && all.PropertyNames.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.PropertyNames = all.PropertyNames - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV1/model_synthetics_mobile_test_initial_application_arguments_property_names.go b/api/datadogV1/model_synthetics_mobile_test_initial_application_arguments_property_names.go deleted file mode 100644 index 52bc1b8a895..00000000000 --- a/api/datadogV1/model_synthetics_mobile_test_initial_application_arguments_property_names.go +++ /dev/null @@ -1,102 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV1 - -import ( - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// SyntheticsMobileTestInitialApplicationArgumentsPropertyNames Name of the property. -type SyntheticsMobileTestInitialApplicationArgumentsPropertyNames struct { - // The `propertyNames` `pattern`. - Pattern *string `json:"pattern,omitempty"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// NewSyntheticsMobileTestInitialApplicationArgumentsPropertyNames instantiates a new SyntheticsMobileTestInitialApplicationArgumentsPropertyNames object. -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewSyntheticsMobileTestInitialApplicationArgumentsPropertyNames() *SyntheticsMobileTestInitialApplicationArgumentsPropertyNames { - this := SyntheticsMobileTestInitialApplicationArgumentsPropertyNames{} - return &this -} - -// NewSyntheticsMobileTestInitialApplicationArgumentsPropertyNamesWithDefaults instantiates a new SyntheticsMobileTestInitialApplicationArgumentsPropertyNames object. -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set. -func NewSyntheticsMobileTestInitialApplicationArgumentsPropertyNamesWithDefaults() *SyntheticsMobileTestInitialApplicationArgumentsPropertyNames { - this := SyntheticsMobileTestInitialApplicationArgumentsPropertyNames{} - return &this -} - -// GetPattern returns the Pattern field value if set, zero value otherwise. -func (o *SyntheticsMobileTestInitialApplicationArgumentsPropertyNames) GetPattern() string { - if o == nil || o.Pattern == nil { - var ret string - return ret - } - return *o.Pattern -} - -// GetPatternOk returns a tuple with the Pattern field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestInitialApplicationArgumentsPropertyNames) GetPatternOk() (*string, bool) { - if o == nil || o.Pattern == nil { - return nil, false - } - return o.Pattern, true -} - -// HasPattern returns a boolean if a field has been set. -func (o *SyntheticsMobileTestInitialApplicationArgumentsPropertyNames) HasPattern() bool { - return o != nil && o.Pattern != nil -} - -// SetPattern gets a reference to the given string and assigns it to the Pattern field. -func (o *SyntheticsMobileTestInitialApplicationArgumentsPropertyNames) SetPattern(v string) { - o.Pattern = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsMobileTestInitialApplicationArgumentsPropertyNames) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.Pattern != nil { - toSerialize["pattern"] = o.Pattern - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsMobileTestInitialApplicationArgumentsPropertyNames) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Pattern *string `json:"pattern,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{"pattern"}) - } else { - return err - } - o.Pattern = all.Pattern - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - return nil -} diff --git a/api/datadogV1/model_synthetics_mobile_test_options.go b/api/datadogV1/model_synthetics_mobile_test_options.go index b4fb27518fc..a7c9abd3d9c 100644 --- a/api/datadogV1/model_synthetics_mobile_test_options.go +++ b/api/datadogV1/model_synthetics_mobile_test_options.go @@ -5,35 +5,37 @@ package datadogV1 import ( + "fmt" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // SyntheticsMobileTestOptions Object describing the extra options for a Synthetic test. type SyntheticsMobileTestOptions struct { - // The `SyntheticsMobileTestOptions` `allowApplicationCrash`. + // A boolean to set if an application crash would mark the test as failed. AllowApplicationCrash *bool `json:"allowApplicationCrash,omitempty"` // Array of bindings used for the mobile test. - Bindings []SyntheticsMobileTestBinding `json:"bindings,omitempty"` + Bindings []SyntheticsTestRestrictionPolicyBinding `json:"bindings,omitempty"` // CI/CD options for a Synthetic test. - Ci *SyntheticsMobileTestCiOptions `json:"ci,omitempty"` - // The `SyntheticsMobileTestOptions` `defaultStepTimeout`. + Ci *SyntheticsTestCiOptions `json:"ci,omitempty"` + // The default timeout for steps in the test (in seconds). DefaultStepTimeout *int32 `json:"defaultStepTimeout,omitempty"` // For mobile test, array with the different device IDs used to run the test. - DeviceIds []string `json:"device_ids,omitempty"` - // The `SyntheticsMobileTestOptions` `disableAutoAcceptAlert`. + DeviceIds []string `json:"device_ids"` + // A boolean to disable auto accepting alerts. DisableAutoAcceptAlert *bool `json:"disableAutoAcceptAlert,omitempty"` // Minimum amount of time in failure required to trigger an alert. MinFailureDuration *int64 `json:"min_failure_duration,omitempty"` // Mobile application for mobile synthetics test. - MobileApplication *SyntheticsMobileTestsMobileApplication `json:"mobileApplication,omitempty"` + MobileApplication SyntheticsMobileTestsMobileApplication `json:"mobileApplication"` // The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs. MonitorName *string `json:"monitor_name,omitempty"` - // Object containing the options for a mobile Synthetic test as a monitor + // Object containing the options for a Synthetic test as a monitor // (for example, renotification). - MonitorOptions *SyntheticsMobileTestOptionsMonitorOptions `json:"monitor_options,omitempty"` + MonitorOptions *SyntheticsTestOptionsMonitorOptions `json:"monitor_options,omitempty"` // Integer from 1 (high) to 5 (low) indicating alert severity. MonitorPriority *int32 `json:"monitor_priority,omitempty"` - // The `SyntheticsMobileTestOptions` `noScreenshot`. + // A boolean set to not take a screenshot for the step. NoScreenshot *bool `json:"noScreenshot,omitempty"` // A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. RestrictedRoles []string `json:"restricted_roles,omitempty"` @@ -42,8 +44,8 @@ type SyntheticsMobileTestOptions struct { // Object containing timeframes and timezone used for advanced scheduling. Scheduling *SyntheticsTestOptionsScheduling `json:"scheduling,omitempty"` // The frequency at which to run the Synthetic test (in seconds). - TickEvery *int64 `json:"tick_every,omitempty"` - // The `SyntheticsMobileTestOptions` `verbosity`. + TickEvery int64 `json:"tick_every"` + // The level of verbosity for the mobile test. Verbosity *int32 `json:"verbosity,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` @@ -54,8 +56,11 @@ type SyntheticsMobileTestOptions struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSyntheticsMobileTestOptions() *SyntheticsMobileTestOptions { +func NewSyntheticsMobileTestOptions(deviceIds []string, mobileApplication SyntheticsMobileTestsMobileApplication, tickEvery int64) *SyntheticsMobileTestOptions { this := SyntheticsMobileTestOptions{} + this.DeviceIds = deviceIds + this.MobileApplication = mobileApplication + this.TickEvery = tickEvery return &this } @@ -96,9 +101,9 @@ func (o *SyntheticsMobileTestOptions) SetAllowApplicationCrash(v bool) { } // GetBindings returns the Bindings field value if set, zero value otherwise. -func (o *SyntheticsMobileTestOptions) GetBindings() []SyntheticsMobileTestBinding { +func (o *SyntheticsMobileTestOptions) GetBindings() []SyntheticsTestRestrictionPolicyBinding { if o == nil || o.Bindings == nil { - var ret []SyntheticsMobileTestBinding + var ret []SyntheticsTestRestrictionPolicyBinding return ret } return o.Bindings @@ -106,7 +111,7 @@ func (o *SyntheticsMobileTestOptions) GetBindings() []SyntheticsMobileTestBindin // GetBindingsOk returns a tuple with the Bindings field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestOptions) GetBindingsOk() (*[]SyntheticsMobileTestBinding, bool) { +func (o *SyntheticsMobileTestOptions) GetBindingsOk() (*[]SyntheticsTestRestrictionPolicyBinding, bool) { if o == nil || o.Bindings == nil { return nil, false } @@ -118,15 +123,15 @@ func (o *SyntheticsMobileTestOptions) HasBindings() bool { return o != nil && o.Bindings != nil } -// SetBindings gets a reference to the given []SyntheticsMobileTestBinding and assigns it to the Bindings field. -func (o *SyntheticsMobileTestOptions) SetBindings(v []SyntheticsMobileTestBinding) { +// SetBindings gets a reference to the given []SyntheticsTestRestrictionPolicyBinding and assigns it to the Bindings field. +func (o *SyntheticsMobileTestOptions) SetBindings(v []SyntheticsTestRestrictionPolicyBinding) { o.Bindings = v } // GetCi returns the Ci field value if set, zero value otherwise. -func (o *SyntheticsMobileTestOptions) GetCi() SyntheticsMobileTestCiOptions { +func (o *SyntheticsMobileTestOptions) GetCi() SyntheticsTestCiOptions { if o == nil || o.Ci == nil { - var ret SyntheticsMobileTestCiOptions + var ret SyntheticsTestCiOptions return ret } return *o.Ci @@ -134,7 +139,7 @@ func (o *SyntheticsMobileTestOptions) GetCi() SyntheticsMobileTestCiOptions { // GetCiOk returns a tuple with the Ci field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestOptions) GetCiOk() (*SyntheticsMobileTestCiOptions, bool) { +func (o *SyntheticsMobileTestOptions) GetCiOk() (*SyntheticsTestCiOptions, bool) { if o == nil || o.Ci == nil { return nil, false } @@ -146,8 +151,8 @@ func (o *SyntheticsMobileTestOptions) HasCi() bool { return o != nil && o.Ci != nil } -// SetCi gets a reference to the given SyntheticsMobileTestCiOptions and assigns it to the Ci field. -func (o *SyntheticsMobileTestOptions) SetCi(v SyntheticsMobileTestCiOptions) { +// SetCi gets a reference to the given SyntheticsTestCiOptions and assigns it to the Ci field. +func (o *SyntheticsMobileTestOptions) SetCi(v SyntheticsTestCiOptions) { o.Ci = &v } @@ -179,30 +184,25 @@ func (o *SyntheticsMobileTestOptions) SetDefaultStepTimeout(v int32) { o.DefaultStepTimeout = &v } -// GetDeviceIds returns the DeviceIds field value if set, zero value otherwise. +// GetDeviceIds returns the DeviceIds field value. func (o *SyntheticsMobileTestOptions) GetDeviceIds() []string { - if o == nil || o.DeviceIds == nil { + if o == nil { var ret []string return ret } return o.DeviceIds } -// GetDeviceIdsOk returns a tuple with the DeviceIds field value if set, nil otherwise +// GetDeviceIdsOk returns a tuple with the DeviceIds field value // and a boolean to check if the value has been set. func (o *SyntheticsMobileTestOptions) GetDeviceIdsOk() (*[]string, bool) { - if o == nil || o.DeviceIds == nil { + if o == nil { return nil, false } return &o.DeviceIds, true } -// HasDeviceIds returns a boolean if a field has been set. -func (o *SyntheticsMobileTestOptions) HasDeviceIds() bool { - return o != nil && o.DeviceIds != nil -} - -// SetDeviceIds gets a reference to the given []string and assigns it to the DeviceIds field. +// SetDeviceIds sets field value. func (o *SyntheticsMobileTestOptions) SetDeviceIds(v []string) { o.DeviceIds = v } @@ -263,32 +263,27 @@ func (o *SyntheticsMobileTestOptions) SetMinFailureDuration(v int64) { o.MinFailureDuration = &v } -// GetMobileApplication returns the MobileApplication field value if set, zero value otherwise. +// GetMobileApplication returns the MobileApplication field value. func (o *SyntheticsMobileTestOptions) GetMobileApplication() SyntheticsMobileTestsMobileApplication { - if o == nil || o.MobileApplication == nil { + if o == nil { var ret SyntheticsMobileTestsMobileApplication return ret } - return *o.MobileApplication + return o.MobileApplication } -// GetMobileApplicationOk returns a tuple with the MobileApplication field value if set, nil otherwise +// GetMobileApplicationOk returns a tuple with the MobileApplication field value // and a boolean to check if the value has been set. func (o *SyntheticsMobileTestOptions) GetMobileApplicationOk() (*SyntheticsMobileTestsMobileApplication, bool) { - if o == nil || o.MobileApplication == nil { + if o == nil { return nil, false } - return o.MobileApplication, true + return &o.MobileApplication, true } -// HasMobileApplication returns a boolean if a field has been set. -func (o *SyntheticsMobileTestOptions) HasMobileApplication() bool { - return o != nil && o.MobileApplication != nil -} - -// SetMobileApplication gets a reference to the given SyntheticsMobileTestsMobileApplication and assigns it to the MobileApplication field. +// SetMobileApplication sets field value. func (o *SyntheticsMobileTestOptions) SetMobileApplication(v SyntheticsMobileTestsMobileApplication) { - o.MobileApplication = &v + o.MobileApplication = v } // GetMonitorName returns the MonitorName field value if set, zero value otherwise. @@ -320,9 +315,9 @@ func (o *SyntheticsMobileTestOptions) SetMonitorName(v string) { } // GetMonitorOptions returns the MonitorOptions field value if set, zero value otherwise. -func (o *SyntheticsMobileTestOptions) GetMonitorOptions() SyntheticsMobileTestOptionsMonitorOptions { +func (o *SyntheticsMobileTestOptions) GetMonitorOptions() SyntheticsTestOptionsMonitorOptions { if o == nil || o.MonitorOptions == nil { - var ret SyntheticsMobileTestOptionsMonitorOptions + var ret SyntheticsTestOptionsMonitorOptions return ret } return *o.MonitorOptions @@ -330,7 +325,7 @@ func (o *SyntheticsMobileTestOptions) GetMonitorOptions() SyntheticsMobileTestOp // GetMonitorOptionsOk returns a tuple with the MonitorOptions field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestOptions) GetMonitorOptionsOk() (*SyntheticsMobileTestOptionsMonitorOptions, bool) { +func (o *SyntheticsMobileTestOptions) GetMonitorOptionsOk() (*SyntheticsTestOptionsMonitorOptions, bool) { if o == nil || o.MonitorOptions == nil { return nil, false } @@ -342,8 +337,8 @@ func (o *SyntheticsMobileTestOptions) HasMonitorOptions() bool { return o != nil && o.MonitorOptions != nil } -// SetMonitorOptions gets a reference to the given SyntheticsMobileTestOptionsMonitorOptions and assigns it to the MonitorOptions field. -func (o *SyntheticsMobileTestOptions) SetMonitorOptions(v SyntheticsMobileTestOptionsMonitorOptions) { +// SetMonitorOptions gets a reference to the given SyntheticsTestOptionsMonitorOptions and assigns it to the MonitorOptions field. +func (o *SyntheticsMobileTestOptions) SetMonitorOptions(v SyntheticsTestOptionsMonitorOptions) { o.MonitorOptions = &v } @@ -487,32 +482,27 @@ func (o *SyntheticsMobileTestOptions) SetScheduling(v SyntheticsTestOptionsSched o.Scheduling = &v } -// GetTickEvery returns the TickEvery field value if set, zero value otherwise. +// GetTickEvery returns the TickEvery field value. func (o *SyntheticsMobileTestOptions) GetTickEvery() int64 { - if o == nil || o.TickEvery == nil { + if o == nil { var ret int64 return ret } - return *o.TickEvery + return o.TickEvery } -// GetTickEveryOk returns a tuple with the TickEvery field value if set, nil otherwise +// GetTickEveryOk returns a tuple with the TickEvery field value // and a boolean to check if the value has been set. func (o *SyntheticsMobileTestOptions) GetTickEveryOk() (*int64, bool) { - if o == nil || o.TickEvery == nil { + if o == nil { return nil, false } - return o.TickEvery, true -} - -// HasTickEvery returns a boolean if a field has been set. -func (o *SyntheticsMobileTestOptions) HasTickEvery() bool { - return o != nil && o.TickEvery != nil + return &o.TickEvery, true } -// SetTickEvery gets a reference to the given int64 and assigns it to the TickEvery field. +// SetTickEvery sets field value. func (o *SyntheticsMobileTestOptions) SetTickEvery(v int64) { - o.TickEvery = &v + o.TickEvery = v } // GetVerbosity returns the Verbosity field value if set, zero value otherwise. @@ -561,18 +551,14 @@ func (o SyntheticsMobileTestOptions) MarshalJSON() ([]byte, error) { if o.DefaultStepTimeout != nil { toSerialize["defaultStepTimeout"] = o.DefaultStepTimeout } - if o.DeviceIds != nil { - toSerialize["device_ids"] = o.DeviceIds - } + toSerialize["device_ids"] = o.DeviceIds if o.DisableAutoAcceptAlert != nil { toSerialize["disableAutoAcceptAlert"] = o.DisableAutoAcceptAlert } if o.MinFailureDuration != nil { toSerialize["min_failure_duration"] = o.MinFailureDuration } - if o.MobileApplication != nil { - toSerialize["mobileApplication"] = o.MobileApplication - } + toSerialize["mobileApplication"] = o.MobileApplication if o.MonitorName != nil { toSerialize["monitor_name"] = o.MonitorName } @@ -594,9 +580,7 @@ func (o SyntheticsMobileTestOptions) MarshalJSON() ([]byte, error) { if o.Scheduling != nil { toSerialize["scheduling"] = o.Scheduling } - if o.TickEvery != nil { - toSerialize["tick_every"] = o.TickEvery - } + toSerialize["tick_every"] = o.TickEvery if o.Verbosity != nil { toSerialize["verbosity"] = o.Verbosity } @@ -610,27 +594,36 @@ func (o SyntheticsMobileTestOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsMobileTestOptions) UnmarshalJSON(bytes []byte) (err error) { all := struct { - AllowApplicationCrash *bool `json:"allowApplicationCrash,omitempty"` - Bindings []SyntheticsMobileTestBinding `json:"bindings,omitempty"` - Ci *SyntheticsMobileTestCiOptions `json:"ci,omitempty"` - DefaultStepTimeout *int32 `json:"defaultStepTimeout,omitempty"` - DeviceIds []string `json:"device_ids,omitempty"` - DisableAutoAcceptAlert *bool `json:"disableAutoAcceptAlert,omitempty"` - MinFailureDuration *int64 `json:"min_failure_duration,omitempty"` - MobileApplication *SyntheticsMobileTestsMobileApplication `json:"mobileApplication,omitempty"` - MonitorName *string `json:"monitor_name,omitempty"` - MonitorOptions *SyntheticsMobileTestOptionsMonitorOptions `json:"monitor_options,omitempty"` - MonitorPriority *int32 `json:"monitor_priority,omitempty"` - NoScreenshot *bool `json:"noScreenshot,omitempty"` - RestrictedRoles []string `json:"restricted_roles,omitempty"` - Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` - Scheduling *SyntheticsTestOptionsScheduling `json:"scheduling,omitempty"` - TickEvery *int64 `json:"tick_every,omitempty"` - Verbosity *int32 `json:"verbosity,omitempty"` + AllowApplicationCrash *bool `json:"allowApplicationCrash,omitempty"` + Bindings []SyntheticsTestRestrictionPolicyBinding `json:"bindings,omitempty"` + Ci *SyntheticsTestCiOptions `json:"ci,omitempty"` + DefaultStepTimeout *int32 `json:"defaultStepTimeout,omitempty"` + DeviceIds *[]string `json:"device_ids"` + DisableAutoAcceptAlert *bool `json:"disableAutoAcceptAlert,omitempty"` + MinFailureDuration *int64 `json:"min_failure_duration,omitempty"` + MobileApplication *SyntheticsMobileTestsMobileApplication `json:"mobileApplication"` + MonitorName *string `json:"monitor_name,omitempty"` + MonitorOptions *SyntheticsTestOptionsMonitorOptions `json:"monitor_options,omitempty"` + MonitorPriority *int32 `json:"monitor_priority,omitempty"` + NoScreenshot *bool `json:"noScreenshot,omitempty"` + RestrictedRoles []string `json:"restricted_roles,omitempty"` + Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` + Scheduling *SyntheticsTestOptionsScheduling `json:"scheduling,omitempty"` + TickEvery *int64 `json:"tick_every"` + Verbosity *int32 `json:"verbosity,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } + if all.DeviceIds == nil { + return fmt.Errorf("required field device_ids missing") + } + if all.MobileApplication == nil { + return fmt.Errorf("required field mobileApplication missing") + } + if all.TickEvery == nil { + return fmt.Errorf("required field tick_every missing") + } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"allowApplicationCrash", "bindings", "ci", "defaultStepTimeout", "device_ids", "disableAutoAcceptAlert", "min_failure_duration", "mobileApplication", "monitor_name", "monitor_options", "monitor_priority", "noScreenshot", "restricted_roles", "retry", "scheduling", "tick_every", "verbosity"}) @@ -646,13 +639,13 @@ func (o *SyntheticsMobileTestOptions) UnmarshalJSON(bytes []byte) (err error) { } o.Ci = all.Ci o.DefaultStepTimeout = all.DefaultStepTimeout - o.DeviceIds = all.DeviceIds + o.DeviceIds = *all.DeviceIds o.DisableAutoAcceptAlert = all.DisableAutoAcceptAlert o.MinFailureDuration = all.MinFailureDuration - if all.MobileApplication != nil && all.MobileApplication.UnparsedObject != nil && o.UnparsedObject == nil { + if all.MobileApplication.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } - o.MobileApplication = all.MobileApplication + o.MobileApplication = *all.MobileApplication o.MonitorName = all.MonitorName if all.MonitorOptions != nil && all.MonitorOptions.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true @@ -669,7 +662,7 @@ func (o *SyntheticsMobileTestOptions) UnmarshalJSON(bytes []byte) (err error) { hasInvalidField = true } o.Scheduling = all.Scheduling - o.TickEvery = all.TickEvery + o.TickEvery = *all.TickEvery o.Verbosity = all.Verbosity if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_synthetics_mobile_test_options_monitor_options.go b/api/datadogV1/model_synthetics_mobile_test_options_monitor_options.go deleted file mode 100644 index e9f58d439a9..00000000000 --- a/api/datadogV1/model_synthetics_mobile_test_options_monitor_options.go +++ /dev/null @@ -1,219 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV1 - -import ( - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// SyntheticsMobileTestOptionsMonitorOptions Object containing the options for a mobile Synthetic test as a monitor -// (for example, renotification). -type SyntheticsMobileTestOptionsMonitorOptions struct { - // Message to include in the escalation notification. - EscalationMessage *string `json:"escalation_message,omitempty"` - // The definition of `SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName` object. - NotificationPresetName *SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName `json:"notification_preset_name,omitempty"` - // Time interval before renotifying if the test is still failing - // (in minutes). - RenotifyInterval *int64 `json:"renotify_interval,omitempty"` - // The `SyntheticsMobileTestOptionsMonitorOptions` `renotify_occurrences`. - RenotifyOccurrences *int64 `json:"renotify_occurrences,omitempty"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// NewSyntheticsMobileTestOptionsMonitorOptions instantiates a new SyntheticsMobileTestOptionsMonitorOptions object. -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewSyntheticsMobileTestOptionsMonitorOptions() *SyntheticsMobileTestOptionsMonitorOptions { - this := SyntheticsMobileTestOptionsMonitorOptions{} - return &this -} - -// NewSyntheticsMobileTestOptionsMonitorOptionsWithDefaults instantiates a new SyntheticsMobileTestOptionsMonitorOptions object. -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set. -func NewSyntheticsMobileTestOptionsMonitorOptionsWithDefaults() *SyntheticsMobileTestOptionsMonitorOptions { - this := SyntheticsMobileTestOptionsMonitorOptions{} - return &this -} - -// GetEscalationMessage returns the EscalationMessage field value if set, zero value otherwise. -func (o *SyntheticsMobileTestOptionsMonitorOptions) GetEscalationMessage() string { - if o == nil || o.EscalationMessage == nil { - var ret string - return ret - } - return *o.EscalationMessage -} - -// GetEscalationMessageOk returns a tuple with the EscalationMessage field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestOptionsMonitorOptions) GetEscalationMessageOk() (*string, bool) { - if o == nil || o.EscalationMessage == nil { - return nil, false - } - return o.EscalationMessage, true -} - -// HasEscalationMessage returns a boolean if a field has been set. -func (o *SyntheticsMobileTestOptionsMonitorOptions) HasEscalationMessage() bool { - return o != nil && o.EscalationMessage != nil -} - -// SetEscalationMessage gets a reference to the given string and assigns it to the EscalationMessage field. -func (o *SyntheticsMobileTestOptionsMonitorOptions) SetEscalationMessage(v string) { - o.EscalationMessage = &v -} - -// GetNotificationPresetName returns the NotificationPresetName field value if set, zero value otherwise. -func (o *SyntheticsMobileTestOptionsMonitorOptions) GetNotificationPresetName() SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName { - if o == nil || o.NotificationPresetName == nil { - var ret SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName - return ret - } - return *o.NotificationPresetName -} - -// GetNotificationPresetNameOk returns a tuple with the NotificationPresetName field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestOptionsMonitorOptions) GetNotificationPresetNameOk() (*SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName, bool) { - if o == nil || o.NotificationPresetName == nil { - return nil, false - } - return o.NotificationPresetName, true -} - -// HasNotificationPresetName returns a boolean if a field has been set. -func (o *SyntheticsMobileTestOptionsMonitorOptions) HasNotificationPresetName() bool { - return o != nil && o.NotificationPresetName != nil -} - -// SetNotificationPresetName gets a reference to the given SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName and assigns it to the NotificationPresetName field. -func (o *SyntheticsMobileTestOptionsMonitorOptions) SetNotificationPresetName(v SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName) { - o.NotificationPresetName = &v -} - -// GetRenotifyInterval returns the RenotifyInterval field value if set, zero value otherwise. -func (o *SyntheticsMobileTestOptionsMonitorOptions) GetRenotifyInterval() int64 { - if o == nil || o.RenotifyInterval == nil { - var ret int64 - return ret - } - return *o.RenotifyInterval -} - -// GetRenotifyIntervalOk returns a tuple with the RenotifyInterval field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestOptionsMonitorOptions) GetRenotifyIntervalOk() (*int64, bool) { - if o == nil || o.RenotifyInterval == nil { - return nil, false - } - return o.RenotifyInterval, true -} - -// HasRenotifyInterval returns a boolean if a field has been set. -func (o *SyntheticsMobileTestOptionsMonitorOptions) HasRenotifyInterval() bool { - return o != nil && o.RenotifyInterval != nil -} - -// SetRenotifyInterval gets a reference to the given int64 and assigns it to the RenotifyInterval field. -func (o *SyntheticsMobileTestOptionsMonitorOptions) SetRenotifyInterval(v int64) { - o.RenotifyInterval = &v -} - -// GetRenotifyOccurrences returns the RenotifyOccurrences field value if set, zero value otherwise. -func (o *SyntheticsMobileTestOptionsMonitorOptions) GetRenotifyOccurrences() int64 { - if o == nil || o.RenotifyOccurrences == nil { - var ret int64 - return ret - } - return *o.RenotifyOccurrences -} - -// GetRenotifyOccurrencesOk returns a tuple with the RenotifyOccurrences field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestOptionsMonitorOptions) GetRenotifyOccurrencesOk() (*int64, bool) { - if o == nil || o.RenotifyOccurrences == nil { - return nil, false - } - return o.RenotifyOccurrences, true -} - -// HasRenotifyOccurrences returns a boolean if a field has been set. -func (o *SyntheticsMobileTestOptionsMonitorOptions) HasRenotifyOccurrences() bool { - return o != nil && o.RenotifyOccurrences != nil -} - -// SetRenotifyOccurrences gets a reference to the given int64 and assigns it to the RenotifyOccurrences field. -func (o *SyntheticsMobileTestOptionsMonitorOptions) SetRenotifyOccurrences(v int64) { - o.RenotifyOccurrences = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o SyntheticsMobileTestOptionsMonitorOptions) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.EscalationMessage != nil { - toSerialize["escalation_message"] = o.EscalationMessage - } - if o.NotificationPresetName != nil { - toSerialize["notification_preset_name"] = o.NotificationPresetName - } - if o.RenotifyInterval != nil { - toSerialize["renotify_interval"] = o.RenotifyInterval - } - if o.RenotifyOccurrences != nil { - toSerialize["renotify_occurrences"] = o.RenotifyOccurrences - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *SyntheticsMobileTestOptionsMonitorOptions) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - EscalationMessage *string `json:"escalation_message,omitempty"` - NotificationPresetName *SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName `json:"notification_preset_name,omitempty"` - RenotifyInterval *int64 `json:"renotify_interval,omitempty"` - RenotifyOccurrences *int64 `json:"renotify_occurrences,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{"escalation_message", "notification_preset_name", "renotify_interval", "renotify_occurrences"}) - } else { - return err - } - - hasInvalidField := false - o.EscalationMessage = all.EscalationMessage - if all.NotificationPresetName != nil && !all.NotificationPresetName.IsValid() { - hasInvalidField = true - } else { - o.NotificationPresetName = all.NotificationPresetName - } - o.RenotifyInterval = all.RenotifyInterval - o.RenotifyOccurrences = all.RenotifyOccurrences - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV1/model_synthetics_mobile_test_options_monitor_options_notification_preset_name.go b/api/datadogV1/model_synthetics_mobile_test_options_monitor_options_notification_preset_name.go deleted file mode 100644 index 73cff926a37..00000000000 --- a/api/datadogV1/model_synthetics_mobile_test_options_monitor_options_notification_preset_name.go +++ /dev/null @@ -1,70 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV1 - -import ( - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName The definition of `SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName` object. -type SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName string - -// List of SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName. -const ( - SYNTHETICSMOBILETESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_SHOW_ALL SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName = "show_all" - SYNTHETICSMOBILETESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_ALL SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName = "hide_all" - SYNTHETICSMOBILETESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_QUERY SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName = "hide_query" - SYNTHETICSMOBILETESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_HANDLES SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName = "hide_handles" -) - -var allowedSyntheticsMobileTestOptionsMonitorOptionsNotificationPresetNameEnumValues = []SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName{ - SYNTHETICSMOBILETESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_SHOW_ALL, - SYNTHETICSMOBILETESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_ALL, - SYNTHETICSMOBILETESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_QUERY, - SYNTHETICSMOBILETESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_HANDLES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName) GetAllowedValues() []SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName { - return allowedSyntheticsMobileTestOptionsMonitorOptionsNotificationPresetNameEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName(value) - return nil -} - -// NewSyntheticsMobileTestOptionsMonitorOptionsNotificationPresetNameFromValue returns a pointer to a valid SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewSyntheticsMobileTestOptionsMonitorOptionsNotificationPresetNameFromValue(v string) (*SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName, error) { - ev := SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName: valid values are %v", v, allowedSyntheticsMobileTestOptionsMonitorOptionsNotificationPresetNameEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName) IsValid() bool { - for _, existing := range allowedSyntheticsMobileTestOptionsMonitorOptionsNotificationPresetNameEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName value. -func (v SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName) Ptr() *SyntheticsMobileTestOptionsMonitorOptionsNotificationPresetName { - return &v -} diff --git a/api/datadogV1/model_synthetics_mobile_tests_mobile_application.go b/api/datadogV1/model_synthetics_mobile_tests_mobile_application.go index 02d7d5928ab..5915748a73c 100644 --- a/api/datadogV1/model_synthetics_mobile_tests_mobile_application.go +++ b/api/datadogV1/model_synthetics_mobile_tests_mobile_application.go @@ -5,17 +5,19 @@ package datadogV1 import ( + "fmt" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // SyntheticsMobileTestsMobileApplication Mobile application for mobile synthetics test. type SyntheticsMobileTestsMobileApplication struct { // Application ID of the mobile application. - ApplicationId *string `json:"applicationId,omitempty"` + ApplicationId string `json:"applicationId"` // Reference ID of the mobile application. - ReferenceId *string `json:"referenceId,omitempty"` + ReferenceId string `json:"referenceId"` // Reference type for the mobile application for a mobile synthetics test. - ReferenceType *SyntheticsMobileTestsMobileApplicationReferenceType `json:"referenceType,omitempty"` + ReferenceType SyntheticsMobileTestsMobileApplicationReferenceType `json:"referenceType"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -25,8 +27,11 @@ type SyntheticsMobileTestsMobileApplication struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSyntheticsMobileTestsMobileApplication() *SyntheticsMobileTestsMobileApplication { +func NewSyntheticsMobileTestsMobileApplication(applicationId string, referenceId string, referenceType SyntheticsMobileTestsMobileApplicationReferenceType) *SyntheticsMobileTestsMobileApplication { this := SyntheticsMobileTestsMobileApplication{} + this.ApplicationId = applicationId + this.ReferenceId = referenceId + this.ReferenceType = referenceType return &this } @@ -38,88 +43,73 @@ func NewSyntheticsMobileTestsMobileApplicationWithDefaults() *SyntheticsMobileTe return &this } -// GetApplicationId returns the ApplicationId field value if set, zero value otherwise. +// GetApplicationId returns the ApplicationId field value. func (o *SyntheticsMobileTestsMobileApplication) GetApplicationId() string { - if o == nil || o.ApplicationId == nil { + if o == nil { var ret string return ret } - return *o.ApplicationId + return o.ApplicationId } -// GetApplicationIdOk returns a tuple with the ApplicationId field value if set, nil otherwise +// GetApplicationIdOk returns a tuple with the ApplicationId field value // and a boolean to check if the value has been set. func (o *SyntheticsMobileTestsMobileApplication) GetApplicationIdOk() (*string, bool) { - if o == nil || o.ApplicationId == nil { + if o == nil { return nil, false } - return o.ApplicationId, true -} - -// HasApplicationId returns a boolean if a field has been set. -func (o *SyntheticsMobileTestsMobileApplication) HasApplicationId() bool { - return o != nil && o.ApplicationId != nil + return &o.ApplicationId, true } -// SetApplicationId gets a reference to the given string and assigns it to the ApplicationId field. +// SetApplicationId sets field value. func (o *SyntheticsMobileTestsMobileApplication) SetApplicationId(v string) { - o.ApplicationId = &v + o.ApplicationId = v } -// GetReferenceId returns the ReferenceId field value if set, zero value otherwise. +// GetReferenceId returns the ReferenceId field value. func (o *SyntheticsMobileTestsMobileApplication) GetReferenceId() string { - if o == nil || o.ReferenceId == nil { + if o == nil { var ret string return ret } - return *o.ReferenceId + return o.ReferenceId } -// GetReferenceIdOk returns a tuple with the ReferenceId field value if set, nil otherwise +// GetReferenceIdOk returns a tuple with the ReferenceId field value // and a boolean to check if the value has been set. func (o *SyntheticsMobileTestsMobileApplication) GetReferenceIdOk() (*string, bool) { - if o == nil || o.ReferenceId == nil { + if o == nil { return nil, false } - return o.ReferenceId, true + return &o.ReferenceId, true } -// HasReferenceId returns a boolean if a field has been set. -func (o *SyntheticsMobileTestsMobileApplication) HasReferenceId() bool { - return o != nil && o.ReferenceId != nil -} - -// SetReferenceId gets a reference to the given string and assigns it to the ReferenceId field. +// SetReferenceId sets field value. func (o *SyntheticsMobileTestsMobileApplication) SetReferenceId(v string) { - o.ReferenceId = &v + o.ReferenceId = v } -// GetReferenceType returns the ReferenceType field value if set, zero value otherwise. +// GetReferenceType returns the ReferenceType field value. func (o *SyntheticsMobileTestsMobileApplication) GetReferenceType() SyntheticsMobileTestsMobileApplicationReferenceType { - if o == nil || o.ReferenceType == nil { + if o == nil { var ret SyntheticsMobileTestsMobileApplicationReferenceType return ret } - return *o.ReferenceType + return o.ReferenceType } -// GetReferenceTypeOk returns a tuple with the ReferenceType field value if set, nil otherwise +// GetReferenceTypeOk returns a tuple with the ReferenceType field value // and a boolean to check if the value has been set. func (o *SyntheticsMobileTestsMobileApplication) GetReferenceTypeOk() (*SyntheticsMobileTestsMobileApplicationReferenceType, bool) { - if o == nil || o.ReferenceType == nil { + if o == nil { return nil, false } - return o.ReferenceType, true -} - -// HasReferenceType returns a boolean if a field has been set. -func (o *SyntheticsMobileTestsMobileApplication) HasReferenceType() bool { - return o != nil && o.ReferenceType != nil + return &o.ReferenceType, true } -// SetReferenceType gets a reference to the given SyntheticsMobileTestsMobileApplicationReferenceType and assigns it to the ReferenceType field. +// SetReferenceType sets field value. func (o *SyntheticsMobileTestsMobileApplication) SetReferenceType(v SyntheticsMobileTestsMobileApplicationReferenceType) { - o.ReferenceType = &v + o.ReferenceType = v } // MarshalJSON serializes the struct using spec logic. @@ -128,15 +118,9 @@ func (o SyntheticsMobileTestsMobileApplication) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - if o.ApplicationId != nil { - toSerialize["applicationId"] = o.ApplicationId - } - if o.ReferenceId != nil { - toSerialize["referenceId"] = o.ReferenceId - } - if o.ReferenceType != nil { - toSerialize["referenceType"] = o.ReferenceType - } + toSerialize["applicationId"] = o.ApplicationId + toSerialize["referenceId"] = o.ReferenceId + toSerialize["referenceType"] = o.ReferenceType for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -147,13 +131,22 @@ func (o SyntheticsMobileTestsMobileApplication) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsMobileTestsMobileApplication) UnmarshalJSON(bytes []byte) (err error) { all := struct { - ApplicationId *string `json:"applicationId,omitempty"` - ReferenceId *string `json:"referenceId,omitempty"` - ReferenceType *SyntheticsMobileTestsMobileApplicationReferenceType `json:"referenceType,omitempty"` + ApplicationId *string `json:"applicationId"` + ReferenceId *string `json:"referenceId"` + ReferenceType *SyntheticsMobileTestsMobileApplicationReferenceType `json:"referenceType"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } + if all.ApplicationId == nil { + return fmt.Errorf("required field applicationId missing") + } + if all.ReferenceId == nil { + return fmt.Errorf("required field referenceId missing") + } + if all.ReferenceType == nil { + return fmt.Errorf("required field referenceType missing") + } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"applicationId", "referenceId", "referenceType"}) @@ -162,12 +155,12 @@ func (o *SyntheticsMobileTestsMobileApplication) UnmarshalJSON(bytes []byte) (er } hasInvalidField := false - o.ApplicationId = all.ApplicationId - o.ReferenceId = all.ReferenceId - if all.ReferenceType != nil && !all.ReferenceType.IsValid() { + o.ApplicationId = *all.ApplicationId + o.ReferenceId = *all.ReferenceId + if !all.ReferenceType.IsValid() { hasInvalidField = true } else { - o.ReferenceType = all.ReferenceType + o.ReferenceType = *all.ReferenceType } if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_synthetics_test_ci_options.go b/api/datadogV1/model_synthetics_test_ci_options.go index 40f185b1eaa..471db8c4b23 100644 --- a/api/datadogV1/model_synthetics_test_ci_options.go +++ b/api/datadogV1/model_synthetics_test_ci_options.go @@ -5,13 +5,15 @@ package datadogV1 import ( + "fmt" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // SyntheticsTestCiOptions CI/CD options for a Synthetic test. type SyntheticsTestCiOptions struct { // Execution rule for a Synthetic test. - ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule,omitempty"` + ExecutionRule SyntheticsTestExecutionRule `json:"executionRule"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -21,8 +23,9 @@ type SyntheticsTestCiOptions struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSyntheticsTestCiOptions() *SyntheticsTestCiOptions { +func NewSyntheticsTestCiOptions(executionRule SyntheticsTestExecutionRule) *SyntheticsTestCiOptions { this := SyntheticsTestCiOptions{} + this.ExecutionRule = executionRule return &this } @@ -34,32 +37,27 @@ func NewSyntheticsTestCiOptionsWithDefaults() *SyntheticsTestCiOptions { return &this } -// GetExecutionRule returns the ExecutionRule field value if set, zero value otherwise. +// GetExecutionRule returns the ExecutionRule field value. func (o *SyntheticsTestCiOptions) GetExecutionRule() SyntheticsTestExecutionRule { - if o == nil || o.ExecutionRule == nil { + if o == nil { var ret SyntheticsTestExecutionRule return ret } - return *o.ExecutionRule + return o.ExecutionRule } -// GetExecutionRuleOk returns a tuple with the ExecutionRule field value if set, nil otherwise +// GetExecutionRuleOk returns a tuple with the ExecutionRule field value // and a boolean to check if the value has been set. func (o *SyntheticsTestCiOptions) GetExecutionRuleOk() (*SyntheticsTestExecutionRule, bool) { - if o == nil || o.ExecutionRule == nil { + if o == nil { return nil, false } - return o.ExecutionRule, true -} - -// HasExecutionRule returns a boolean if a field has been set. -func (o *SyntheticsTestCiOptions) HasExecutionRule() bool { - return o != nil && o.ExecutionRule != nil + return &o.ExecutionRule, true } -// SetExecutionRule gets a reference to the given SyntheticsTestExecutionRule and assigns it to the ExecutionRule field. +// SetExecutionRule sets field value. func (o *SyntheticsTestCiOptions) SetExecutionRule(v SyntheticsTestExecutionRule) { - o.ExecutionRule = &v + o.ExecutionRule = v } // MarshalJSON serializes the struct using spec logic. @@ -68,9 +66,7 @@ func (o SyntheticsTestCiOptions) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - if o.ExecutionRule != nil { - toSerialize["executionRule"] = o.ExecutionRule - } + toSerialize["executionRule"] = o.ExecutionRule for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -81,11 +77,14 @@ func (o SyntheticsTestCiOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestCiOptions) UnmarshalJSON(bytes []byte) (err error) { all := struct { - ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule,omitempty"` + ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } + if all.ExecutionRule == nil { + return fmt.Errorf("required field executionRule missing") + } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"executionRule"}) @@ -94,10 +93,10 @@ func (o *SyntheticsTestCiOptions) UnmarshalJSON(bytes []byte) (err error) { } hasInvalidField := false - if all.ExecutionRule != nil && !all.ExecutionRule.IsValid() { + if !all.ExecutionRule.IsValid() { hasInvalidField = true } else { - o.ExecutionRule = all.ExecutionRule + o.ExecutionRule = *all.ExecutionRule } if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_synthetics_test_options_monitor_options.go b/api/datadogV1/model_synthetics_test_options_monitor_options.go index 7a9052501a8..6adf5b3b141 100644 --- a/api/datadogV1/model_synthetics_test_options_monitor_options.go +++ b/api/datadogV1/model_synthetics_test_options_monitor_options.go @@ -11,9 +11,15 @@ import ( // SyntheticsTestOptionsMonitorOptions Object containing the options for a Synthetic test as a monitor // (for example, renotification). type SyntheticsTestOptionsMonitorOptions struct { + // Message to include in the escalation notification. + EscalationMessage *string `json:"escalation_message,omitempty"` + // The name of the preset for the notification for the monitor. + NotificationPresetName *SyntheticsTestOptionsMonitorOptionsNotificationPresetName `json:"notification_preset_name,omitempty"` // Time interval before renotifying if the test is still failing // (in minutes). RenotifyInterval *int64 `json:"renotify_interval,omitempty"` + // The number of times to renotify if the test is still failing. + RenotifyOccurrences *int64 `json:"renotify_occurrences,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -36,6 +42,62 @@ func NewSyntheticsTestOptionsMonitorOptionsWithDefaults() *SyntheticsTestOptions return &this } +// GetEscalationMessage returns the EscalationMessage field value if set, zero value otherwise. +func (o *SyntheticsTestOptionsMonitorOptions) GetEscalationMessage() string { + if o == nil || o.EscalationMessage == nil { + var ret string + return ret + } + return *o.EscalationMessage +} + +// GetEscalationMessageOk returns a tuple with the EscalationMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptionsMonitorOptions) GetEscalationMessageOk() (*string, bool) { + if o == nil || o.EscalationMessage == nil { + return nil, false + } + return o.EscalationMessage, true +} + +// HasEscalationMessage returns a boolean if a field has been set. +func (o *SyntheticsTestOptionsMonitorOptions) HasEscalationMessage() bool { + return o != nil && o.EscalationMessage != nil +} + +// SetEscalationMessage gets a reference to the given string and assigns it to the EscalationMessage field. +func (o *SyntheticsTestOptionsMonitorOptions) SetEscalationMessage(v string) { + o.EscalationMessage = &v +} + +// GetNotificationPresetName returns the NotificationPresetName field value if set, zero value otherwise. +func (o *SyntheticsTestOptionsMonitorOptions) GetNotificationPresetName() SyntheticsTestOptionsMonitorOptionsNotificationPresetName { + if o == nil || o.NotificationPresetName == nil { + var ret SyntheticsTestOptionsMonitorOptionsNotificationPresetName + return ret + } + return *o.NotificationPresetName +} + +// GetNotificationPresetNameOk returns a tuple with the NotificationPresetName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptionsMonitorOptions) GetNotificationPresetNameOk() (*SyntheticsTestOptionsMonitorOptionsNotificationPresetName, bool) { + if o == nil || o.NotificationPresetName == nil { + return nil, false + } + return o.NotificationPresetName, true +} + +// HasNotificationPresetName returns a boolean if a field has been set. +func (o *SyntheticsTestOptionsMonitorOptions) HasNotificationPresetName() bool { + return o != nil && o.NotificationPresetName != nil +} + +// SetNotificationPresetName gets a reference to the given SyntheticsTestOptionsMonitorOptionsNotificationPresetName and assigns it to the NotificationPresetName field. +func (o *SyntheticsTestOptionsMonitorOptions) SetNotificationPresetName(v SyntheticsTestOptionsMonitorOptionsNotificationPresetName) { + o.NotificationPresetName = &v +} + // GetRenotifyInterval returns the RenotifyInterval field value if set, zero value otherwise. func (o *SyntheticsTestOptionsMonitorOptions) GetRenotifyInterval() int64 { if o == nil || o.RenotifyInterval == nil { @@ -64,15 +126,52 @@ func (o *SyntheticsTestOptionsMonitorOptions) SetRenotifyInterval(v int64) { o.RenotifyInterval = &v } +// GetRenotifyOccurrences returns the RenotifyOccurrences field value if set, zero value otherwise. +func (o *SyntheticsTestOptionsMonitorOptions) GetRenotifyOccurrences() int64 { + if o == nil || o.RenotifyOccurrences == nil { + var ret int64 + return ret + } + return *o.RenotifyOccurrences +} + +// GetRenotifyOccurrencesOk returns a tuple with the RenotifyOccurrences field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsTestOptionsMonitorOptions) GetRenotifyOccurrencesOk() (*int64, bool) { + if o == nil || o.RenotifyOccurrences == nil { + return nil, false + } + return o.RenotifyOccurrences, true +} + +// HasRenotifyOccurrences returns a boolean if a field has been set. +func (o *SyntheticsTestOptionsMonitorOptions) HasRenotifyOccurrences() bool { + return o != nil && o.RenotifyOccurrences != nil +} + +// SetRenotifyOccurrences gets a reference to the given int64 and assigns it to the RenotifyOccurrences field. +func (o *SyntheticsTestOptionsMonitorOptions) SetRenotifyOccurrences(v int64) { + o.RenotifyOccurrences = &v +} + // MarshalJSON serializes the struct using spec logic. func (o SyntheticsTestOptionsMonitorOptions) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } + if o.EscalationMessage != nil { + toSerialize["escalation_message"] = o.EscalationMessage + } + if o.NotificationPresetName != nil { + toSerialize["notification_preset_name"] = o.NotificationPresetName + } if o.RenotifyInterval != nil { toSerialize["renotify_interval"] = o.RenotifyInterval } + if o.RenotifyOccurrences != nil { + toSerialize["renotify_occurrences"] = o.RenotifyOccurrences + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -83,22 +182,38 @@ func (o SyntheticsTestOptionsMonitorOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestOptionsMonitorOptions) UnmarshalJSON(bytes []byte) (err error) { all := struct { - RenotifyInterval *int64 `json:"renotify_interval,omitempty"` + EscalationMessage *string `json:"escalation_message,omitempty"` + NotificationPresetName *SyntheticsTestOptionsMonitorOptionsNotificationPresetName `json:"notification_preset_name,omitempty"` + RenotifyInterval *int64 `json:"renotify_interval,omitempty"` + RenotifyOccurrences *int64 `json:"renotify_occurrences,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{"renotify_interval"}) + datadog.DeleteKeys(additionalProperties, &[]string{"escalation_message", "notification_preset_name", "renotify_interval", "renotify_occurrences"}) } else { return err } + + hasInvalidField := false + o.EscalationMessage = all.EscalationMessage + if all.NotificationPresetName != nil && !all.NotificationPresetName.IsValid() { + hasInvalidField = true + } else { + o.NotificationPresetName = all.NotificationPresetName + } o.RenotifyInterval = all.RenotifyInterval + o.RenotifyOccurrences = all.RenotifyOccurrences if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/api/datadogV1/model_synthetics_test_options_monitor_options_notification_preset_name.go b/api/datadogV1/model_synthetics_test_options_monitor_options_notification_preset_name.go new file mode 100644 index 00000000000..6c1fe56fe0c --- /dev/null +++ b/api/datadogV1/model_synthetics_test_options_monitor_options_notification_preset_name.go @@ -0,0 +1,70 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsTestOptionsMonitorOptionsNotificationPresetName The name of the preset for the notification for the monitor. +type SyntheticsTestOptionsMonitorOptionsNotificationPresetName string + +// List of SyntheticsTestOptionsMonitorOptionsNotificationPresetName. +const ( + SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_SHOW_ALL SyntheticsTestOptionsMonitorOptionsNotificationPresetName = "show_all" + SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_ALL SyntheticsTestOptionsMonitorOptionsNotificationPresetName = "hide_all" + SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_QUERY SyntheticsTestOptionsMonitorOptionsNotificationPresetName = "hide_query" + SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_HANDLES SyntheticsTestOptionsMonitorOptionsNotificationPresetName = "hide_handles" +) + +var allowedSyntheticsTestOptionsMonitorOptionsNotificationPresetNameEnumValues = []SyntheticsTestOptionsMonitorOptionsNotificationPresetName{ + SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_SHOW_ALL, + SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_ALL, + SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_QUERY, + SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_HIDE_HANDLES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsTestOptionsMonitorOptionsNotificationPresetName) GetAllowedValues() []SyntheticsTestOptionsMonitorOptionsNotificationPresetName { + return allowedSyntheticsTestOptionsMonitorOptionsNotificationPresetNameEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsTestOptionsMonitorOptionsNotificationPresetName) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsTestOptionsMonitorOptionsNotificationPresetName(value) + return nil +} + +// NewSyntheticsTestOptionsMonitorOptionsNotificationPresetNameFromValue returns a pointer to a valid SyntheticsTestOptionsMonitorOptionsNotificationPresetName +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsTestOptionsMonitorOptionsNotificationPresetNameFromValue(v string) (*SyntheticsTestOptionsMonitorOptionsNotificationPresetName, error) { + ev := SyntheticsTestOptionsMonitorOptionsNotificationPresetName(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestOptionsMonitorOptionsNotificationPresetName: valid values are %v", v, allowedSyntheticsTestOptionsMonitorOptionsNotificationPresetNameEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsTestOptionsMonitorOptionsNotificationPresetName) IsValid() bool { + for _, existing := range allowedSyntheticsTestOptionsMonitorOptionsNotificationPresetNameEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsTestOptionsMonitorOptionsNotificationPresetName value. +func (v SyntheticsTestOptionsMonitorOptionsNotificationPresetName) Ptr() *SyntheticsTestOptionsMonitorOptionsNotificationPresetName { + return &v +} diff --git a/api/datadogV1/model_synthetics_test_options_scheduling.go b/api/datadogV1/model_synthetics_test_options_scheduling.go index e4b456f4fdb..2f0e334bf9b 100644 --- a/api/datadogV1/model_synthetics_test_options_scheduling.go +++ b/api/datadogV1/model_synthetics_test_options_scheduling.go @@ -5,15 +5,17 @@ package datadogV1 import ( + "fmt" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // SyntheticsTestOptionsScheduling Object containing timeframes and timezone used for advanced scheduling. type SyntheticsTestOptionsScheduling struct { // Array containing objects describing the scheduling pattern to apply to each day. - Timeframes []SyntheticsTestOptionsSchedulingTimeframe `json:"timeframes,omitempty"` + Timeframes []SyntheticsTestOptionsSchedulingTimeframe `json:"timeframes"` // Timezone in which the timeframe is based. - Timezone *string `json:"timezone,omitempty"` + Timezone string `json:"timezone"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -23,8 +25,10 @@ type SyntheticsTestOptionsScheduling struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSyntheticsTestOptionsScheduling() *SyntheticsTestOptionsScheduling { +func NewSyntheticsTestOptionsScheduling(timeframes []SyntheticsTestOptionsSchedulingTimeframe, timezone string) *SyntheticsTestOptionsScheduling { this := SyntheticsTestOptionsScheduling{} + this.Timeframes = timeframes + this.Timezone = timezone return &this } @@ -36,60 +40,50 @@ func NewSyntheticsTestOptionsSchedulingWithDefaults() *SyntheticsTestOptionsSche return &this } -// GetTimeframes returns the Timeframes field value if set, zero value otherwise. +// GetTimeframes returns the Timeframes field value. func (o *SyntheticsTestOptionsScheduling) GetTimeframes() []SyntheticsTestOptionsSchedulingTimeframe { - if o == nil || o.Timeframes == nil { + if o == nil { var ret []SyntheticsTestOptionsSchedulingTimeframe return ret } return o.Timeframes } -// GetTimeframesOk returns a tuple with the Timeframes field value if set, nil otherwise +// GetTimeframesOk returns a tuple with the Timeframes field value // and a boolean to check if the value has been set. func (o *SyntheticsTestOptionsScheduling) GetTimeframesOk() (*[]SyntheticsTestOptionsSchedulingTimeframe, bool) { - if o == nil || o.Timeframes == nil { + if o == nil { return nil, false } return &o.Timeframes, true } -// HasTimeframes returns a boolean if a field has been set. -func (o *SyntheticsTestOptionsScheduling) HasTimeframes() bool { - return o != nil && o.Timeframes != nil -} - -// SetTimeframes gets a reference to the given []SyntheticsTestOptionsSchedulingTimeframe and assigns it to the Timeframes field. +// SetTimeframes sets field value. func (o *SyntheticsTestOptionsScheduling) SetTimeframes(v []SyntheticsTestOptionsSchedulingTimeframe) { o.Timeframes = v } -// GetTimezone returns the Timezone field value if set, zero value otherwise. +// GetTimezone returns the Timezone field value. func (o *SyntheticsTestOptionsScheduling) GetTimezone() string { - if o == nil || o.Timezone == nil { + if o == nil { var ret string return ret } - return *o.Timezone + return o.Timezone } -// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// GetTimezoneOk returns a tuple with the Timezone field value // and a boolean to check if the value has been set. func (o *SyntheticsTestOptionsScheduling) GetTimezoneOk() (*string, bool) { - if o == nil || o.Timezone == nil { + if o == nil { return nil, false } - return o.Timezone, true -} - -// HasTimezone returns a boolean if a field has been set. -func (o *SyntheticsTestOptionsScheduling) HasTimezone() bool { - return o != nil && o.Timezone != nil + return &o.Timezone, true } -// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +// SetTimezone sets field value. func (o *SyntheticsTestOptionsScheduling) SetTimezone(v string) { - o.Timezone = &v + o.Timezone = v } // MarshalJSON serializes the struct using spec logic. @@ -98,12 +92,8 @@ func (o SyntheticsTestOptionsScheduling) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - if o.Timeframes != nil { - toSerialize["timeframes"] = o.Timeframes - } - if o.Timezone != nil { - toSerialize["timezone"] = o.Timezone - } + toSerialize["timeframes"] = o.Timeframes + toSerialize["timezone"] = o.Timezone for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -114,20 +104,26 @@ func (o SyntheticsTestOptionsScheduling) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestOptionsScheduling) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Timeframes []SyntheticsTestOptionsSchedulingTimeframe `json:"timeframes,omitempty"` - Timezone *string `json:"timezone,omitempty"` + Timeframes *[]SyntheticsTestOptionsSchedulingTimeframe `json:"timeframes"` + Timezone *string `json:"timezone"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } + if all.Timeframes == nil { + return fmt.Errorf("required field timeframes missing") + } + if all.Timezone == nil { + return fmt.Errorf("required field timezone missing") + } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"timeframes", "timezone"}) } else { return err } - o.Timeframes = all.Timeframes - o.Timezone = all.Timezone + o.Timeframes = *all.Timeframes + o.Timezone = *all.Timezone if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go b/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go index a10e084ee1d..aedd35fbe4d 100644 --- a/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go +++ b/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go @@ -5,17 +5,19 @@ package datadogV1 import ( + "fmt" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // SyntheticsTestOptionsSchedulingTimeframe Object describing a timeframe. type SyntheticsTestOptionsSchedulingTimeframe struct { // Number representing the day of the week. - Day *int32 `json:"day,omitempty"` + Day int32 `json:"day"` // The hour of the day on which scheduling starts. - From *string `json:"from,omitempty"` + From string `json:"from"` // The hour of the day on which scheduling ends. - To *string `json:"to,omitempty"` + To string `json:"to"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -25,8 +27,11 @@ type SyntheticsTestOptionsSchedulingTimeframe struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSyntheticsTestOptionsSchedulingTimeframe() *SyntheticsTestOptionsSchedulingTimeframe { +func NewSyntheticsTestOptionsSchedulingTimeframe(day int32, from string, to string) *SyntheticsTestOptionsSchedulingTimeframe { this := SyntheticsTestOptionsSchedulingTimeframe{} + this.Day = day + this.From = from + this.To = to return &this } @@ -38,88 +43,73 @@ func NewSyntheticsTestOptionsSchedulingTimeframeWithDefaults() *SyntheticsTestOp return &this } -// GetDay returns the Day field value if set, zero value otherwise. +// GetDay returns the Day field value. func (o *SyntheticsTestOptionsSchedulingTimeframe) GetDay() int32 { - if o == nil || o.Day == nil { + if o == nil { var ret int32 return ret } - return *o.Day + return o.Day } -// GetDayOk returns a tuple with the Day field value if set, nil otherwise +// GetDayOk returns a tuple with the Day field value // and a boolean to check if the value has been set. func (o *SyntheticsTestOptionsSchedulingTimeframe) GetDayOk() (*int32, bool) { - if o == nil || o.Day == nil { + if o == nil { return nil, false } - return o.Day, true -} - -// HasDay returns a boolean if a field has been set. -func (o *SyntheticsTestOptionsSchedulingTimeframe) HasDay() bool { - return o != nil && o.Day != nil + return &o.Day, true } -// SetDay gets a reference to the given int32 and assigns it to the Day field. +// SetDay sets field value. func (o *SyntheticsTestOptionsSchedulingTimeframe) SetDay(v int32) { - o.Day = &v + o.Day = v } -// GetFrom returns the From field value if set, zero value otherwise. +// GetFrom returns the From field value. func (o *SyntheticsTestOptionsSchedulingTimeframe) GetFrom() string { - if o == nil || o.From == nil { + if o == nil { var ret string return ret } - return *o.From + return o.From } -// GetFromOk returns a tuple with the From field value if set, nil otherwise +// GetFromOk returns a tuple with the From field value // and a boolean to check if the value has been set. func (o *SyntheticsTestOptionsSchedulingTimeframe) GetFromOk() (*string, bool) { - if o == nil || o.From == nil { + if o == nil { return nil, false } - return o.From, true + return &o.From, true } -// HasFrom returns a boolean if a field has been set. -func (o *SyntheticsTestOptionsSchedulingTimeframe) HasFrom() bool { - return o != nil && o.From != nil -} - -// SetFrom gets a reference to the given string and assigns it to the From field. +// SetFrom sets field value. func (o *SyntheticsTestOptionsSchedulingTimeframe) SetFrom(v string) { - o.From = &v + o.From = v } -// GetTo returns the To field value if set, zero value otherwise. +// GetTo returns the To field value. func (o *SyntheticsTestOptionsSchedulingTimeframe) GetTo() string { - if o == nil || o.To == nil { + if o == nil { var ret string return ret } - return *o.To + return o.To } -// GetToOk returns a tuple with the To field value if set, nil otherwise +// GetToOk returns a tuple with the To field value // and a boolean to check if the value has been set. func (o *SyntheticsTestOptionsSchedulingTimeframe) GetToOk() (*string, bool) { - if o == nil || o.To == nil { + if o == nil { return nil, false } - return o.To, true -} - -// HasTo returns a boolean if a field has been set. -func (o *SyntheticsTestOptionsSchedulingTimeframe) HasTo() bool { - return o != nil && o.To != nil + return &o.To, true } -// SetTo gets a reference to the given string and assigns it to the To field. +// SetTo sets field value. func (o *SyntheticsTestOptionsSchedulingTimeframe) SetTo(v string) { - o.To = &v + o.To = v } // MarshalJSON serializes the struct using spec logic. @@ -128,15 +118,9 @@ func (o SyntheticsTestOptionsSchedulingTimeframe) MarshalJSON() ([]byte, error) if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - if o.Day != nil { - toSerialize["day"] = o.Day - } - if o.From != nil { - toSerialize["from"] = o.From - } - if o.To != nil { - toSerialize["to"] = o.To - } + toSerialize["day"] = o.Day + toSerialize["from"] = o.From + toSerialize["to"] = o.To for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -147,22 +131,31 @@ func (o SyntheticsTestOptionsSchedulingTimeframe) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestOptionsSchedulingTimeframe) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Day *int32 `json:"day,omitempty"` - From *string `json:"from,omitempty"` - To *string `json:"to,omitempty"` + Day *int32 `json:"day"` + From *string `json:"from"` + To *string `json:"to"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } + if all.Day == nil { + return fmt.Errorf("required field day missing") + } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"day", "from", "to"}) } else { return err } - o.Day = all.Day - o.From = all.From - o.To = all.To + o.Day = *all.Day + o.From = *all.From + o.To = *all.To if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_synthetics_mobile_test_binding_items.go b/api/datadogV1/model_synthetics_test_restriction_policy_binding.go similarity index 52% rename from api/datadogV1/model_synthetics_mobile_test_binding_items.go rename to api/datadogV1/model_synthetics_test_restriction_policy_binding.go index ea531e2386d..d9e3a4902e0 100644 --- a/api/datadogV1/model_synthetics_mobile_test_binding_items.go +++ b/api/datadogV1/model_synthetics_test_restriction_policy_binding.go @@ -8,36 +8,36 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// SyntheticsMobileTestBindingItems Object describing the binding used for a mobile test. -type SyntheticsMobileTestBindingItems struct { +// SyntheticsTestRestrictionPolicyBinding Objects describing the binding used for a mobile test. +type SyntheticsTestRestrictionPolicyBinding struct { // List of principals for a mobile test binding. Principals []string `json:"principals,omitempty"` - // The definition of `SyntheticsMobileTestBindingItemsRole` object. - Role *SyntheticsMobileTestBindingItemsRole `json:"role,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 UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` } -// NewSyntheticsMobileTestBindingItems instantiates a new SyntheticsMobileTestBindingItems object. +// NewSyntheticsTestRestrictionPolicyBinding instantiates a new SyntheticsTestRestrictionPolicyBinding object. // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSyntheticsMobileTestBindingItems() *SyntheticsMobileTestBindingItems { - this := SyntheticsMobileTestBindingItems{} +func NewSyntheticsTestRestrictionPolicyBinding() *SyntheticsTestRestrictionPolicyBinding { + this := SyntheticsTestRestrictionPolicyBinding{} return &this } -// NewSyntheticsMobileTestBindingItemsWithDefaults instantiates a new SyntheticsMobileTestBindingItems object. +// NewSyntheticsTestRestrictionPolicyBindingWithDefaults instantiates a new SyntheticsTestRestrictionPolicyBinding object. // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set. -func NewSyntheticsMobileTestBindingItemsWithDefaults() *SyntheticsMobileTestBindingItems { - this := SyntheticsMobileTestBindingItems{} +func NewSyntheticsTestRestrictionPolicyBindingWithDefaults() *SyntheticsTestRestrictionPolicyBinding { + this := SyntheticsTestRestrictionPolicyBinding{} return &this } // GetPrincipals returns the Principals field value if set, zero value otherwise. -func (o *SyntheticsMobileTestBindingItems) GetPrincipals() []string { +func (o *SyntheticsTestRestrictionPolicyBinding) GetPrincipals() []string { if o == nil || o.Principals == nil { var ret []string return ret @@ -47,7 +47,7 @@ func (o *SyntheticsMobileTestBindingItems) GetPrincipals() []string { // 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 *SyntheticsMobileTestBindingItems) GetPrincipalsOk() (*[]string, bool) { +func (o *SyntheticsTestRestrictionPolicyBinding) GetPrincipalsOk() (*[]string, bool) { if o == nil || o.Principals == nil { return nil, false } @@ -55,45 +55,45 @@ func (o *SyntheticsMobileTestBindingItems) GetPrincipalsOk() (*[]string, bool) { } // HasPrincipals returns a boolean if a field has been set. -func (o *SyntheticsMobileTestBindingItems) HasPrincipals() bool { +func (o *SyntheticsTestRestrictionPolicyBinding) HasPrincipals() bool { return o != nil && o.Principals != nil } // SetPrincipals gets a reference to the given []string and assigns it to the Principals field. -func (o *SyntheticsMobileTestBindingItems) SetPrincipals(v []string) { +func (o *SyntheticsTestRestrictionPolicyBinding) SetPrincipals(v []string) { o.Principals = v } -// GetRole returns the Role field value if set, zero value otherwise. -func (o *SyntheticsMobileTestBindingItems) GetRole() SyntheticsMobileTestBindingItemsRole { - if o == nil || o.Role == nil { - var ret SyntheticsMobileTestBindingItemsRole +// GetRelation returns the Relation field value if set, zero value otherwise. +func (o *SyntheticsTestRestrictionPolicyBinding) GetRelation() SyntheticsTestRestrictionPolicyBindingRelation { + if o == nil || o.Relation == nil { + var ret SyntheticsTestRestrictionPolicyBindingRelation return ret } - return *o.Role + return *o.Relation } -// GetRoleOk returns a tuple with the Role field value if set, nil otherwise +// GetRelationOk returns a tuple with the Relation field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *SyntheticsMobileTestBindingItems) GetRoleOk() (*SyntheticsMobileTestBindingItemsRole, bool) { - if o == nil || o.Role == nil { +func (o *SyntheticsTestRestrictionPolicyBinding) GetRelationOk() (*SyntheticsTestRestrictionPolicyBindingRelation, bool) { + if o == nil || o.Relation == nil { return nil, false } - return o.Role, true + return o.Relation, true } -// HasRole returns a boolean if a field has been set. -func (o *SyntheticsMobileTestBindingItems) HasRole() bool { - return o != nil && o.Role != nil +// HasRelation returns a boolean if a field has been set. +func (o *SyntheticsTestRestrictionPolicyBinding) HasRelation() bool { + return o != nil && o.Relation != nil } -// SetRole gets a reference to the given SyntheticsMobileTestBindingItemsRole and assigns it to the Role field. -func (o *SyntheticsMobileTestBindingItems) SetRole(v SyntheticsMobileTestBindingItemsRole) { - o.Role = &v +// SetRelation gets a reference to the given SyntheticsTestRestrictionPolicyBindingRelation and assigns it to the Relation field. +func (o *SyntheticsTestRestrictionPolicyBinding) SetRelation(v SyntheticsTestRestrictionPolicyBindingRelation) { + o.Relation = &v } // MarshalJSON serializes the struct using spec logic. -func (o SyntheticsMobileTestBindingItems) MarshalJSON() ([]byte, error) { +func (o SyntheticsTestRestrictionPolicyBinding) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) @@ -101,8 +101,8 @@ func (o SyntheticsMobileTestBindingItems) MarshalJSON() ([]byte, error) { if o.Principals != nil { toSerialize["principals"] = o.Principals } - if o.Role != nil { - toSerialize["role"] = o.Role + if o.Relation != nil { + toSerialize["relation"] = o.Relation } for key, value := range o.AdditionalProperties { @@ -112,27 +112,27 @@ func (o SyntheticsMobileTestBindingItems) MarshalJSON() ([]byte, error) { } // UnmarshalJSON deserializes the given payload. -func (o *SyntheticsMobileTestBindingItems) UnmarshalJSON(bytes []byte) (err error) { +func (o *SyntheticsTestRestrictionPolicyBinding) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Principals []string `json:"principals,omitempty"` - Role *SyntheticsMobileTestBindingItemsRole `json:"role,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{"principals", "role"}) + datadog.DeleteKeys(additionalProperties, &[]string{"principals", "relation"}) } else { return err } hasInvalidField := false o.Principals = all.Principals - if all.Role != nil && !all.Role.IsValid() { + if all.Relation != nil && !all.Relation.IsValid() { hasInvalidField = true } else { - o.Role = all.Role + o.Relation = all.Relation } if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_synthetics_test_restriction_policy_binding_relation.go b/api/datadogV1/model_synthetics_test_restriction_policy_binding_relation.go new file mode 100644 index 00000000000..9e8e1252a8c --- /dev/null +++ b/api/datadogV1/model_synthetics_test_restriction_policy_binding_relation.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyntheticsTestRestrictionPolicyBindingRelation The type of relation for the binding. +type SyntheticsTestRestrictionPolicyBindingRelation string + +// List of SyntheticsTestRestrictionPolicyBindingRelation. +const ( + SYNTHETICSTESTRESTRICTIONPOLICYBINDINGRELATION_EDITOR SyntheticsTestRestrictionPolicyBindingRelation = "editor" + SYNTHETICSTESTRESTRICTIONPOLICYBINDINGRELATION_VIEWER SyntheticsTestRestrictionPolicyBindingRelation = "viewer" +) + +var allowedSyntheticsTestRestrictionPolicyBindingRelationEnumValues = []SyntheticsTestRestrictionPolicyBindingRelation{ + SYNTHETICSTESTRESTRICTIONPOLICYBINDINGRELATION_EDITOR, + SYNTHETICSTESTRESTRICTIONPOLICYBINDINGRELATION_VIEWER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsTestRestrictionPolicyBindingRelation) GetAllowedValues() []SyntheticsTestRestrictionPolicyBindingRelation { + return allowedSyntheticsTestRestrictionPolicyBindingRelationEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsTestRestrictionPolicyBindingRelation) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsTestRestrictionPolicyBindingRelation(value) + return nil +} + +// NewSyntheticsTestRestrictionPolicyBindingRelationFromValue returns a pointer to a valid SyntheticsTestRestrictionPolicyBindingRelation +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsTestRestrictionPolicyBindingRelationFromValue(v string) (*SyntheticsTestRestrictionPolicyBindingRelation, error) { + ev := SyntheticsTestRestrictionPolicyBindingRelation(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsTestRestrictionPolicyBindingRelation: valid values are %v", v, allowedSyntheticsTestRestrictionPolicyBindingRelationEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsTestRestrictionPolicyBindingRelation) IsValid() bool { + for _, existing := range allowedSyntheticsTestRestrictionPolicyBindingRelationEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsTestRestrictionPolicyBindingRelation value. +func (v SyntheticsTestRestrictionPolicyBindingRelation) Ptr() *SyntheticsTestRestrictionPolicyBindingRelation { + return &v +} diff --git a/examples/v1/synthetics/CreateSyntheticsAPITest.go b/examples/v1/synthetics/CreateSyntheticsAPITest.go index d6d915be6ee..784ec62b9f5 100644 --- a/examples/v1/synthetics/CreateSyntheticsAPITest.go +++ b/examples/v1/synthetics/CreateSyntheticsAPITest.go @@ -35,13 +35,15 @@ func main() { Name: "Example test name", Options: datadogV1.SyntheticsTestOptions{ Ci: &datadogV1.SyntheticsTestCiOptions{ - ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_BLOCKING.Ptr(), + ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_BLOCKING, }, DeviceIds: []datadogV1.SyntheticsDeviceID{ datadogV1.SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE, }, - HttpVersion: datadogV1.SYNTHETICSTESTOPTIONSHTTPVERSION_HTTP1.Ptr(), - MonitorOptions: &datadogV1.SyntheticsTestOptionsMonitorOptions{}, + HttpVersion: datadogV1.SYNTHETICSTESTOPTIONSHTTPVERSION_HTTP1.Ptr(), + MonitorOptions: &datadogV1.SyntheticsTestOptionsMonitorOptions{ + NotificationPresetName: datadogV1.SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_SHOW_ALL.Ptr(), + }, RestrictedRoles: []string{ "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", }, @@ -54,17 +56,17 @@ func main() { Scheduling: &datadogV1.SyntheticsTestOptionsScheduling{ Timeframes: []datadogV1.SyntheticsTestOptionsSchedulingTimeframe{ { - Day: datadog.PtrInt32(1), - From: datadog.PtrString("07:00"), - To: datadog.PtrString("16:00"), + Day: 1, + From: "07:00", + To: "16:00", }, { - Day: datadog.PtrInt32(3), - From: datadog.PtrString("07:00"), - To: datadog.PtrString("16:00"), + Day: 3, + From: "07:00", + To: "16:00", }, }, - Timezone: datadog.PtrString("America/New_York"), + Timezone: "America/New_York", }, }, Status: datadogV1.SYNTHETICSTESTPAUSESTATUS_LIVE.Ptr(), diff --git a/examples/v1/synthetics/CreateSyntheticsBrowserTest_2932742688.go b/examples/v1/synthetics/CreateSyntheticsBrowserTest_2932742688.go index 2b38d104fb4..1b16e817553 100644 --- a/examples/v1/synthetics/CreateSyntheticsBrowserTest_2932742688.go +++ b/examples/v1/synthetics/CreateSyntheticsBrowserTest_2932742688.go @@ -60,7 +60,7 @@ func main() { }, TickEvery: datadog.PtrInt64(300), Ci: &datadogV1.SyntheticsTestCiOptions{ - ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_SKIPPED.Ptr(), + ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_SKIPPED, }, IgnoreServerCertificateError: datadog.PtrBool(true), DisableCsp: datadog.PtrBool(true), diff --git a/examples/v1/synthetics/CreateSyntheticsBrowserTest_397420811.go b/examples/v1/synthetics/CreateSyntheticsBrowserTest_397420811.go index b7e74104d29..cb8540f7668 100644 --- a/examples/v1/synthetics/CreateSyntheticsBrowserTest_397420811.go +++ b/examples/v1/synthetics/CreateSyntheticsBrowserTest_397420811.go @@ -54,17 +54,17 @@ func main() { Scheduling: &datadogV1.SyntheticsTestOptionsScheduling{ Timeframes: []datadogV1.SyntheticsTestOptionsSchedulingTimeframe{ { - Day: datadog.PtrInt32(1), - From: datadog.PtrString("07:00"), - To: datadog.PtrString("16:00"), + Day: 1, + From: "07:00", + To: "16:00", }, { - Day: datadog.PtrInt32(3), - From: datadog.PtrString("07:00"), - To: datadog.PtrString("16:00"), + Day: 3, + From: "07:00", + To: "16:00", }, }, - Timezone: datadog.PtrString("America/New_York"), + Timezone: "America/New_York", }, }, Tags: []string{ diff --git a/examples/v1/synthetics/CreateSyntheticsMobileTest.go b/examples/v1/synthetics/CreateSyntheticsMobileTest.go index 1207adc709c..67500a84735 100644 --- a/examples/v1/synthetics/CreateSyntheticsMobileTest.go +++ b/examples/v1/synthetics/CreateSyntheticsMobileTest.go @@ -25,12 +25,12 @@ func main() { DeviceIds: []string{ "synthetics:mobile:device:iphone_15_ios_17", }, - MobileApplication: &datadogV1.SyntheticsMobileTestsMobileApplication{ - ApplicationId: datadog.PtrString("ab0e0aed-536d-411a-9a99-5428c27d8f8e"), - ReferenceId: datadog.PtrString("6115922a-5f5d-455e-bc7e-7955a57f3815"), - ReferenceType: datadogV1.SYNTHETICSMOBILETESTSMOBILEAPPLICATIONREFERENCETYPE_VERSION.Ptr(), + MobileApplication: datadogV1.SyntheticsMobileTestsMobileApplication{ + ApplicationId: "ab0e0aed-536d-411a-9a99-5428c27d8f8e", + ReferenceId: "6115922a-5f5d-455e-bc7e-7955a57f3815", + ReferenceType: datadogV1.SYNTHETICSMOBILETESTSMOBILEAPPLICATIONREFERENCETYPE_VERSION, }, - TickEvery: datadog.PtrInt64(3600), + TickEvery: 3600, }, Steps: []datadogV1.SyntheticsMobileStep{}, } diff --git a/examples/v1/synthetics/UpdateBrowserTest.go b/examples/v1/synthetics/UpdateBrowserTest.go index 1927ea29176..11f877636e6 100644 --- a/examples/v1/synthetics/UpdateBrowserTest.go +++ b/examples/v1/synthetics/UpdateBrowserTest.go @@ -61,13 +61,15 @@ func main() { Name: "Example test name", Options: datadogV1.SyntheticsTestOptions{ Ci: &datadogV1.SyntheticsTestCiOptions{ - ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_BLOCKING.Ptr(), + ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_BLOCKING, }, DeviceIds: []datadogV1.SyntheticsDeviceID{ datadogV1.SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE, }, - HttpVersion: datadogV1.SYNTHETICSTESTOPTIONSHTTPVERSION_HTTP1.Ptr(), - MonitorOptions: &datadogV1.SyntheticsTestOptionsMonitorOptions{}, + HttpVersion: datadogV1.SYNTHETICSTESTOPTIONSHTTPVERSION_HTTP1.Ptr(), + MonitorOptions: &datadogV1.SyntheticsTestOptionsMonitorOptions{ + NotificationPresetName: datadogV1.SYNTHETICSTESTOPTIONSMONITOROPTIONSNOTIFICATIONPRESETNAME_SHOW_ALL.Ptr(), + }, RestrictedRoles: []string{ "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", }, @@ -80,17 +82,17 @@ func main() { Scheduling: &datadogV1.SyntheticsTestOptionsScheduling{ Timeframes: []datadogV1.SyntheticsTestOptionsSchedulingTimeframe{ { - Day: datadog.PtrInt32(1), - From: datadog.PtrString("07:00"), - To: datadog.PtrString("16:00"), + Day: 1, + From: "07:00", + To: "16:00", }, { - Day: datadog.PtrInt32(3), - From: datadog.PtrString("07:00"), - To: datadog.PtrString("16:00"), + Day: 3, + From: "07:00", + To: "16:00", }, }, - Timezone: datadog.PtrString("America/New_York"), + Timezone: "America/New_York", }, }, Status: datadogV1.SYNTHETICSTESTPAUSESTATUS_LIVE.Ptr(), diff --git a/examples/v1/synthetics/UpdateMobileTest.go b/examples/v1/synthetics/UpdateMobileTest.go index a2b654e084e..dd5cad0d71d 100644 --- a/examples/v1/synthetics/UpdateMobileTest.go +++ b/examples/v1/synthetics/UpdateMobileTest.go @@ -28,12 +28,12 @@ func main() { DeviceIds: []string{ "synthetics:mobile:device:iphone_15_ios_17", }, - MobileApplication: &datadogV1.SyntheticsMobileTestsMobileApplication{ - ApplicationId: datadog.PtrString("ab0e0aed-536d-411a-9a99-5428c27d8f8e"), - ReferenceId: datadog.PtrString("6115922a-5f5d-455e-bc7e-7955a57f3815"), - ReferenceType: datadogV1.SYNTHETICSMOBILETESTSMOBILEAPPLICATIONREFERENCETYPE_VERSION.Ptr(), + MobileApplication: datadogV1.SyntheticsMobileTestsMobileApplication{ + ApplicationId: "ab0e0aed-536d-411a-9a99-5428c27d8f8e", + ReferenceId: "6115922a-5f5d-455e-bc7e-7955a57f3815", + ReferenceType: datadogV1.SYNTHETICSMOBILETESTSMOBILEAPPLICATIONREFERENCETYPE_VERSION, }, - TickEvery: datadog.PtrInt64(3600), + TickEvery: 3600, }, Steps: []datadogV1.SyntheticsMobileStep{}, } diff --git a/tests/scenarios/features/v1/synthetics.feature b/tests/scenarios/features/v1/synthetics.feature index a980f84c43e..fb90d094941 100644 --- a/tests/scenarios/features/v1/synthetics.feature +++ b/tests/scenarios/features/v1/synthetics.feature @@ -52,7 +52,7 @@ Feature: Synthetics @generated @skip @team:DataDog/synthetics-ct Scenario: Create a browser test returns "- JSON format is wrong" response Given new "CreateSyntheticsBrowserTest" request - And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} + And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} When the request is sent Then the response status is 400 - JSON format is wrong @@ -79,7 +79,7 @@ Feature: Synthetics @generated @skip @team:DataDog/synthetics-ct Scenario: Create a browser test returns "Test quota is reached" response Given new "CreateSyntheticsBrowserTest" request - And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} + And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} When the request is sent Then the response status is 402 Test quota is reached @@ -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": {"initialApplicationArguments": {"propertyNames": {"pattern": "^(?!_dd).*$"}}, "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": [{"items": {"principals": [], "role": "editor"}}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"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"}}, "status": "live", "steps": [{"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": {"initialApplicationArguments": {"propertyNames": {"pattern": "^(?!_dd).*$"}}, "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": [{"items": {"principals": [], "role": "editor"}}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"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"}}, "status": "live", "steps": [{"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 @@ -237,21 +237,21 @@ Feature: Synthetics @generated @skip @team:DataDog/synthetics-ct Scenario: Create an API test returns "- JSON format is wrong" response Given new "CreateSyntheticsAPITest" request - And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} + And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} When the request is sent Then the response status is 400 - JSON format is wrong @generated @skip @team:DataDog/synthetics-ct Scenario: Create an API test returns "OK - Returns the created test details." response Given new "CreateSyntheticsAPITest" request - And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} + And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} When the request is sent Then the response status is 200 OK - Returns the created test details. @generated @skip @team:DataDog/synthetics-ct Scenario: Create an API test returns "Test quota is reached" response Given new "CreateSyntheticsAPITest" request - And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} + And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} 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": {"initialApplicationArguments": {"propertyNames": {"pattern": "^(?!_dd).*$"}}, "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": [{"items": {"principals": [], "role": "editor"}}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"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"}}, "status": "live", "steps": [{"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": {"initialApplicationArguments": {"propertyNames": {"pattern": "^(?!_dd).*$"}}, "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": [{"items": {"principals": [], "role": "editor"}}], "ci": {"executionRule": "blocking"}, "device_ids": ["synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"], "mobileApplication": {"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"}}, "status": "live", "steps": [{"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 @@ -391,7 +391,7 @@ Feature: Synthetics Scenario: Edit a browser test returns "- JSON format is wrong" response Given new "UpdateBrowserTest" request And request contains "public_id" parameter from "REPLACE.ME" - And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} + And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} When the request is sent Then the response status is 400 - JSON format is wrong @@ -399,7 +399,7 @@ Feature: Synthetics Scenario: Edit a browser test returns "- Synthetic Monitoring is not activated for the user" response Given new "UpdateBrowserTest" request And request contains "public_id" parameter from "REPLACE.ME" - And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} + And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} When the request is sent Then the response status is 404 - Synthetic Monitoring is not activated for the user @@ -407,7 +407,7 @@ Feature: Synthetics Scenario: Edit a browser test returns "OK" response Given new "UpdateBrowserTest" request And request contains "public_id" parameter from "REPLACE.ME" - And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} + And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "secure": false, "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "callType": "unary", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "files": [{}], "httpVersion": "http1", "proxy": {"url": "https://example.com"}, "service": "Greeter", "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"} When the request is sent Then the response status is 200 OK @@ -447,7 +447,7 @@ Feature: Synthetics Scenario: Edit an API test returns "- JSON format is wrong" response Given new "UpdateAPITest" request And request contains "public_id" parameter from "REPLACE.ME" - And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} + And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} When the request is sent Then the response status is 400 - JSON format is wrong @@ -455,7 +455,7 @@ Feature: Synthetics Scenario: Edit an API test returns "- Synthetic Monitoring is not activated for the user" response Given new "UpdateAPITest" request And request contains "public_id" parameter from "REPLACE.ME" - And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} + And body with value {"config": {"assertions": [{"operator": "lessThan", "target": 1000, "type": "responseTime"}], "request": {"method": "GET", "url": "https://example.com"}}, "locations": ["aws:eu-west-3"], "message": "Notification message", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["chrome.laptop_large"], "httpVersion": "http1", "monitor_options": {"notification_preset_name": "show_all"}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}, "scheduling": {"timeframes": [{"day": 1, "from": "07:00", "to": "16:00"}, {"day": 3, "from": "07:00", "to": "16:00"}], "timezone": "America/New_York"}}, "status": "live", "subtype": "http", "tags": ["env:production"], "type": "api"} When the request is sent Then the response status is 404 - Synthetic Monitoring is not activated for the user