|
| 1 | +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 2 | +// This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 3 | +// Copyright 2019-Present Datadog, Inc. |
| 4 | + |
| 5 | +package datadogV1 |
| 6 | + |
| 7 | +import ( |
| 8 | + "fmt" |
| 9 | + |
| 10 | + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" |
| 11 | +) |
| 12 | + |
| 13 | +// MonitorFormulaAndFunctionDataJobsQueryDefinition A formula and functions data jobs query. |
| 14 | +type MonitorFormulaAndFunctionDataJobsQueryDefinition struct { |
| 15 | + // The type of job being monitored. Valid values include: |
| 16 | + // `databricks.job`, `spark.application`, `airflow.dag`, |
| 17 | + // `dbt.job`, `dbt.model`, `dbt.test`, `glue.job`. |
| 18 | + // Custom job types are supported with the `custom.ol.` prefix. |
| 19 | + JobType string `json:"job_type"` |
| 20 | + // Filter expression used to select the jobs to monitor. |
| 21 | + JobsQuery string `json:"jobs_query"` |
| 22 | + // Name of the query for use in formulas. Must be `run_query`. |
| 23 | + Name string `json:"name"` |
| 24 | + // Query dialect for data jobs queries. Currently only `metric` is supported. |
| 25 | + QueryDialect string `json:"query_dialect"` |
| 26 | + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct |
| 27 | + UnparsedObject map[string]interface{} `json:"-"` |
| 28 | + AdditionalProperties map[string]interface{} `json:"-"` |
| 29 | +} |
| 30 | + |
| 31 | +// NewMonitorFormulaAndFunctionDataJobsQueryDefinition instantiates a new MonitorFormulaAndFunctionDataJobsQueryDefinition object. |
| 32 | +// This constructor will assign default values to properties that have it defined, |
| 33 | +// and makes sure properties required by API are set, but the set of arguments |
| 34 | +// will change when the set of required properties is changed. |
| 35 | +func NewMonitorFormulaAndFunctionDataJobsQueryDefinition(jobType string, jobsQuery string, name string, queryDialect string) *MonitorFormulaAndFunctionDataJobsQueryDefinition { |
| 36 | + this := MonitorFormulaAndFunctionDataJobsQueryDefinition{} |
| 37 | + this.JobType = jobType |
| 38 | + this.JobsQuery = jobsQuery |
| 39 | + this.Name = name |
| 40 | + this.QueryDialect = queryDialect |
| 41 | + return &this |
| 42 | +} |
| 43 | + |
| 44 | +// NewMonitorFormulaAndFunctionDataJobsQueryDefinitionWithDefaults instantiates a new MonitorFormulaAndFunctionDataJobsQueryDefinition object. |
| 45 | +// This constructor will only assign default values to properties that have it defined, |
| 46 | +// but it doesn't guarantee that properties required by API are set. |
| 47 | +func NewMonitorFormulaAndFunctionDataJobsQueryDefinitionWithDefaults() *MonitorFormulaAndFunctionDataJobsQueryDefinition { |
| 48 | + this := MonitorFormulaAndFunctionDataJobsQueryDefinition{} |
| 49 | + return &this |
| 50 | +} |
| 51 | + |
| 52 | +// GetJobType returns the JobType field value. |
| 53 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) GetJobType() string { |
| 54 | + if o == nil { |
| 55 | + var ret string |
| 56 | + return ret |
| 57 | + } |
| 58 | + return o.JobType |
| 59 | +} |
| 60 | + |
| 61 | +// GetJobTypeOk returns a tuple with the JobType field value |
| 62 | +// and a boolean to check if the value has been set. |
| 63 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) GetJobTypeOk() (*string, bool) { |
| 64 | + if o == nil { |
| 65 | + return nil, false |
| 66 | + } |
| 67 | + return &o.JobType, true |
| 68 | +} |
| 69 | + |
| 70 | +// SetJobType sets field value. |
| 71 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) SetJobType(v string) { |
| 72 | + o.JobType = v |
| 73 | +} |
| 74 | + |
| 75 | +// GetJobsQuery returns the JobsQuery field value. |
| 76 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) GetJobsQuery() string { |
| 77 | + if o == nil { |
| 78 | + var ret string |
| 79 | + return ret |
| 80 | + } |
| 81 | + return o.JobsQuery |
| 82 | +} |
| 83 | + |
| 84 | +// GetJobsQueryOk returns a tuple with the JobsQuery field value |
| 85 | +// and a boolean to check if the value has been set. |
| 86 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) GetJobsQueryOk() (*string, bool) { |
| 87 | + if o == nil { |
| 88 | + return nil, false |
| 89 | + } |
| 90 | + return &o.JobsQuery, true |
| 91 | +} |
| 92 | + |
| 93 | +// SetJobsQuery sets field value. |
| 94 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) SetJobsQuery(v string) { |
| 95 | + o.JobsQuery = v |
| 96 | +} |
| 97 | + |
| 98 | +// GetName returns the Name field value. |
| 99 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) GetName() string { |
| 100 | + if o == nil { |
| 101 | + var ret string |
| 102 | + return ret |
| 103 | + } |
| 104 | + return o.Name |
| 105 | +} |
| 106 | + |
| 107 | +// GetNameOk returns a tuple with the Name field value |
| 108 | +// and a boolean to check if the value has been set. |
| 109 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) GetNameOk() (*string, bool) { |
| 110 | + if o == nil { |
| 111 | + return nil, false |
| 112 | + } |
| 113 | + return &o.Name, true |
| 114 | +} |
| 115 | + |
| 116 | +// SetName sets field value. |
| 117 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) SetName(v string) { |
| 118 | + o.Name = v |
| 119 | +} |
| 120 | + |
| 121 | +// GetQueryDialect returns the QueryDialect field value. |
| 122 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) GetQueryDialect() string { |
| 123 | + if o == nil { |
| 124 | + var ret string |
| 125 | + return ret |
| 126 | + } |
| 127 | + return o.QueryDialect |
| 128 | +} |
| 129 | + |
| 130 | +// GetQueryDialectOk returns a tuple with the QueryDialect field value |
| 131 | +// and a boolean to check if the value has been set. |
| 132 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) GetQueryDialectOk() (*string, bool) { |
| 133 | + if o == nil { |
| 134 | + return nil, false |
| 135 | + } |
| 136 | + return &o.QueryDialect, true |
| 137 | +} |
| 138 | + |
| 139 | +// SetQueryDialect sets field value. |
| 140 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) SetQueryDialect(v string) { |
| 141 | + o.QueryDialect = v |
| 142 | +} |
| 143 | + |
| 144 | +// MarshalJSON serializes the struct using spec logic. |
| 145 | +func (o MonitorFormulaAndFunctionDataJobsQueryDefinition) MarshalJSON() ([]byte, error) { |
| 146 | + toSerialize := map[string]interface{}{} |
| 147 | + if o.UnparsedObject != nil { |
| 148 | + return datadog.Marshal(o.UnparsedObject) |
| 149 | + } |
| 150 | + toSerialize["job_type"] = o.JobType |
| 151 | + toSerialize["jobs_query"] = o.JobsQuery |
| 152 | + toSerialize["name"] = o.Name |
| 153 | + toSerialize["query_dialect"] = o.QueryDialect |
| 154 | + |
| 155 | + for key, value := range o.AdditionalProperties { |
| 156 | + toSerialize[key] = value |
| 157 | + } |
| 158 | + return datadog.Marshal(toSerialize) |
| 159 | +} |
| 160 | + |
| 161 | +// UnmarshalJSON deserializes the given payload. |
| 162 | +func (o *MonitorFormulaAndFunctionDataJobsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { |
| 163 | + all := struct { |
| 164 | + JobType *string `json:"job_type"` |
| 165 | + JobsQuery *string `json:"jobs_query"` |
| 166 | + Name *string `json:"name"` |
| 167 | + QueryDialect *string `json:"query_dialect"` |
| 168 | + }{} |
| 169 | + if err = datadog.Unmarshal(bytes, &all); err != nil { |
| 170 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 171 | + } |
| 172 | + if all.JobType == nil { |
| 173 | + return fmt.Errorf("required field job_type missing") |
| 174 | + } |
| 175 | + if all.JobsQuery == nil { |
| 176 | + return fmt.Errorf("required field jobs_query missing") |
| 177 | + } |
| 178 | + if all.Name == nil { |
| 179 | + return fmt.Errorf("required field name missing") |
| 180 | + } |
| 181 | + if all.QueryDialect == nil { |
| 182 | + return fmt.Errorf("required field query_dialect missing") |
| 183 | + } |
| 184 | + additionalProperties := make(map[string]interface{}) |
| 185 | + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { |
| 186 | + datadog.DeleteKeys(additionalProperties, &[]string{"job_type", "jobs_query", "name", "query_dialect"}) |
| 187 | + } else { |
| 188 | + return err |
| 189 | + } |
| 190 | + o.JobType = *all.JobType |
| 191 | + o.JobsQuery = *all.JobsQuery |
| 192 | + o.Name = *all.Name |
| 193 | + o.QueryDialect = *all.QueryDialect |
| 194 | + |
| 195 | + if len(additionalProperties) > 0 { |
| 196 | + o.AdditionalProperties = additionalProperties |
| 197 | + } |
| 198 | + |
| 199 | + return nil |
| 200 | +} |
0 commit comments