model_metoro_ql_timeseries.go•4.79 kB
/*
Metoro API
API for managing Metoro environments, alerts, and dashboards.
API version: 1.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package model
import (
"bytes"
"encoding/json"
"fmt"
)
// checks if the MetoroQlTimeseries type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &MetoroQlTimeseries{}
// MetoroQlTimeseries struct for MetoroQlTimeseries
type MetoroQlTimeseries struct {
// MetoroQL query to use for the timeseries.
Query string `json:"query"`
// The size of each bucket to aggregate data into in seconds. For example, if the bucket size is 60, the data will be aggregated into 1 minute buckets.
BucketSize int64 `json:"bucketSize"`
}
type _MetoroQlTimeseries MetoroQlTimeseries
// NewMetoroQlTimeseries instantiates a new MetoroQlTimeseries 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 NewMetoroQlTimeseries(query string, bucketSize int64) *MetoroQlTimeseries {
this := MetoroQlTimeseries{}
this.Query = query
this.BucketSize = bucketSize
return &this
}
// NewMetoroQlTimeseriesWithDefaults instantiates a new MetoroQlTimeseries 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 NewMetoroQlTimeseriesWithDefaults() *MetoroQlTimeseries {
this := MetoroQlTimeseries{}
return &this
}
// GetQuery returns the Query field value
func (o *MetoroQlTimeseries) GetQuery() string {
if o == nil {
var ret string
return ret
}
return o.Query
}
// GetQueryOk returns a tuple with the Query field value
// and a boolean to check if the value has been set.
func (o *MetoroQlTimeseries) GetQueryOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Query, true
}
// SetQuery sets field value
func (o *MetoroQlTimeseries) SetQuery(v string) {
o.Query = v
}
// GetBucketSize returns the BucketSize field value
func (o *MetoroQlTimeseries) GetBucketSize() int64 {
if o == nil {
var ret int64
return ret
}
return o.BucketSize
}
// GetBucketSizeOk returns a tuple with the BucketSize field value
// and a boolean to check if the value has been set.
func (o *MetoroQlTimeseries) GetBucketSizeOk() (*int64, bool) {
if o == nil {
return nil, false
}
return &o.BucketSize, true
}
// SetBucketSize sets field value
func (o *MetoroQlTimeseries) SetBucketSize(v int64) {
o.BucketSize = v
}
func (o MetoroQlTimeseries) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o MetoroQlTimeseries) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["query"] = o.Query
toSerialize["bucketSize"] = o.BucketSize
return toSerialize, nil
}
func (o *MetoroQlTimeseries) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"query",
"bucketSize",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varMetoroQlTimeseries := _MetoroQlTimeseries{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varMetoroQlTimeseries)
if err != nil {
return err
}
*o = MetoroQlTimeseries(varMetoroQlTimeseries)
return err
}
type NullableMetoroQlTimeseries struct {
value *MetoroQlTimeseries
isSet bool
}
func (v NullableMetoroQlTimeseries) Get() *MetoroQlTimeseries {
return v.value
}
func (v *NullableMetoroQlTimeseries) Set(val *MetoroQlTimeseries) {
v.value = val
v.isSet = true
}
func (v NullableMetoroQlTimeseries) IsSet() bool {
return v.isSet
}
func (v *NullableMetoroQlTimeseries) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableMetoroQlTimeseries(val *MetoroQlTimeseries) *NullableMetoroQlTimeseries {
return &NullableMetoroQlTimeseries{value: val, isSet: true}
}
func (v NullableMetoroQlTimeseries) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableMetoroQlTimeseries) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}