5
5
package datadogV1
6
6
7
7
import (
8
- "fmt"
9
-
10
8
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11
9
)
12
10
13
11
// GeomapWidgetDefinitionView The view of the world that the map should render.
14
12
type GeomapWidgetDefinitionView struct {
15
- // The 2-letter ISO code of a country to focus the map on. Or `WORLD`.
16
- Focus string `json:"focus"`
13
+ // A custom extent of the map defined by an array of four numbers in the order `[minLongitude, minLatitude, maxLongitude, maxLatitude]`. Mutually exclusive with `focus`.
14
+ CustomExtent []float64 `json:"custom_extent,omitempty"`
15
+ // The 2-letter ISO code of a country to focus the map on. Or `WORLD`. Mutually exclusive with `custom_extent`.
16
+ Focus * string `json:"focus,omitempty"`
17
17
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
18
18
UnparsedObject map [string ]interface {} `json:"-"`
19
19
AdditionalProperties map [string ]interface {} `json:"-"`
@@ -23,9 +23,8 @@ type GeomapWidgetDefinitionView struct {
23
23
// This constructor will assign default values to properties that have it defined,
24
24
// and makes sure properties required by API are set, but the set of arguments
25
25
// will change when the set of required properties is changed.
26
- func NewGeomapWidgetDefinitionView (focus string ) * GeomapWidgetDefinitionView {
26
+ func NewGeomapWidgetDefinitionView () * GeomapWidgetDefinitionView {
27
27
this := GeomapWidgetDefinitionView {}
28
- this .Focus = focus
29
28
return & this
30
29
}
31
30
@@ -37,27 +36,60 @@ func NewGeomapWidgetDefinitionViewWithDefaults() *GeomapWidgetDefinitionView {
37
36
return & this
38
37
}
39
38
40
- // GetFocus returns the Focus field value.
39
+ // GetCustomExtent returns the CustomExtent field value if set, zero value otherwise.
40
+ func (o * GeomapWidgetDefinitionView ) GetCustomExtent () []float64 {
41
+ if o == nil || o .CustomExtent == nil {
42
+ var ret []float64
43
+ return ret
44
+ }
45
+ return o .CustomExtent
46
+ }
47
+
48
+ // GetCustomExtentOk returns a tuple with the CustomExtent field value if set, nil otherwise
49
+ // and a boolean to check if the value has been set.
50
+ func (o * GeomapWidgetDefinitionView ) GetCustomExtentOk () (* []float64 , bool ) {
51
+ if o == nil || o .CustomExtent == nil {
52
+ return nil , false
53
+ }
54
+ return & o .CustomExtent , true
55
+ }
56
+
57
+ // HasCustomExtent returns a boolean if a field has been set.
58
+ func (o * GeomapWidgetDefinitionView ) HasCustomExtent () bool {
59
+ return o != nil && o .CustomExtent != nil
60
+ }
61
+
62
+ // SetCustomExtent gets a reference to the given []float64 and assigns it to the CustomExtent field.
63
+ func (o * GeomapWidgetDefinitionView ) SetCustomExtent (v []float64 ) {
64
+ o .CustomExtent = v
65
+ }
66
+
67
+ // GetFocus returns the Focus field value if set, zero value otherwise.
41
68
func (o * GeomapWidgetDefinitionView ) GetFocus () string {
42
- if o == nil {
69
+ if o == nil || o . Focus == nil {
43
70
var ret string
44
71
return ret
45
72
}
46
- return o .Focus
73
+ return * o .Focus
47
74
}
48
75
49
- // GetFocusOk returns a tuple with the Focus field value
76
+ // GetFocusOk returns a tuple with the Focus field value if set, nil otherwise
50
77
// and a boolean to check if the value has been set.
51
78
func (o * GeomapWidgetDefinitionView ) GetFocusOk () (* string , bool ) {
52
- if o == nil {
79
+ if o == nil || o . Focus == nil {
53
80
return nil , false
54
81
}
55
- return & o .Focus , true
82
+ return o .Focus , true
56
83
}
57
84
58
- // SetFocus sets field value.
85
+ // HasFocus returns a boolean if a field has been set.
86
+ func (o * GeomapWidgetDefinitionView ) HasFocus () bool {
87
+ return o != nil && o .Focus != nil
88
+ }
89
+
90
+ // SetFocus gets a reference to the given string and assigns it to the Focus field.
59
91
func (o * GeomapWidgetDefinitionView ) SetFocus (v string ) {
60
- o .Focus = v
92
+ o .Focus = & v
61
93
}
62
94
63
95
// MarshalJSON serializes the struct using spec logic.
@@ -66,7 +98,12 @@ func (o GeomapWidgetDefinitionView) MarshalJSON() ([]byte, error) {
66
98
if o .UnparsedObject != nil {
67
99
return datadog .Marshal (o .UnparsedObject )
68
100
}
69
- toSerialize ["focus" ] = o .Focus
101
+ if o .CustomExtent != nil {
102
+ toSerialize ["custom_extent" ] = o .CustomExtent
103
+ }
104
+ if o .Focus != nil {
105
+ toSerialize ["focus" ] = o .Focus
106
+ }
70
107
71
108
for key , value := range o .AdditionalProperties {
72
109
toSerialize [key ] = value
@@ -77,21 +114,20 @@ func (o GeomapWidgetDefinitionView) MarshalJSON() ([]byte, error) {
77
114
// UnmarshalJSON deserializes the given payload.
78
115
func (o * GeomapWidgetDefinitionView ) UnmarshalJSON (bytes []byte ) (err error ) {
79
116
all := struct {
80
- Focus * string `json:"focus"`
117
+ CustomExtent []float64 `json:"custom_extent,omitempty"`
118
+ Focus * string `json:"focus,omitempty"`
81
119
}{}
82
120
if err = datadog .Unmarshal (bytes , & all ); err != nil {
83
121
return datadog .Unmarshal (bytes , & o .UnparsedObject )
84
122
}
85
- if all .Focus == nil {
86
- return fmt .Errorf ("required field focus missing" )
87
- }
88
123
additionalProperties := make (map [string ]interface {})
89
124
if err = datadog .Unmarshal (bytes , & additionalProperties ); err == nil {
90
- datadog .DeleteKeys (additionalProperties , & []string {"focus" })
125
+ datadog .DeleteKeys (additionalProperties , & []string {"custom_extent" , " focus" })
91
126
} else {
92
127
return err
93
128
}
94
- o .Focus = * all .Focus
129
+ o .CustomExtent = all .CustomExtent
130
+ o .Focus = all .Focus
95
131
96
132
if len (additionalProperties ) > 0 {
97
133
o .AdditionalProperties = additionalProperties
0 commit comments