Skip to content

Commit db7630a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Reference Tables API spec (#3389)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 0361c97 commit db7630a

File tree

73 files changed

+10914
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+10914
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 1297 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/api_reference_tables.go

Lines changed: 643 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/doc.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,13 @@
420420
// - [RUMApi.ListRUMEvents]
421421
// - [RUMApi.SearchRUMEvents]
422422
// - [RUMApi.UpdateRUMApplication]
423+
// - [ReferenceTablesApi.CreateReferenceTable]
424+
// - [ReferenceTablesApi.CreateReferenceTableUpload]
425+
// - [ReferenceTablesApi.DeleteTable]
426+
// - [ReferenceTablesApi.GetRowsByID]
427+
// - [ReferenceTablesApi.GetTable]
428+
// - [ReferenceTablesApi.ListTables]
429+
// - [ReferenceTablesApi.UpdateReferenceTable]
423430
// - [RestrictionPoliciesApi.DeleteRestrictionPolicy]
424431
// - [RestrictionPoliciesApi.GetRestrictionPolicy]
425432
// - [RestrictionPoliciesApi.UpdateRestrictionPolicy]
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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 datadogV2
6+
7+
import (
8+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// CreateTableRequest The definition of `CreateTableRequest` object.
12+
type CreateTableRequest struct {
13+
// The definition of `CreateTableRequestData` object.
14+
Data *CreateTableRequestData `json:"data,omitempty"`
15+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
16+
UnparsedObject map[string]interface{} `json:"-"`
17+
AdditionalProperties map[string]interface{} `json:"-"`
18+
}
19+
20+
// NewCreateTableRequest instantiates a new CreateTableRequest object.
21+
// This constructor will assign default values to properties that have it defined,
22+
// and makes sure properties required by API are set, but the set of arguments
23+
// will change when the set of required properties is changed.
24+
func NewCreateTableRequest() *CreateTableRequest {
25+
this := CreateTableRequest{}
26+
return &this
27+
}
28+
29+
// NewCreateTableRequestWithDefaults instantiates a new CreateTableRequest object.
30+
// This constructor will only assign default values to properties that have it defined,
31+
// but it doesn't guarantee that properties required by API are set.
32+
func NewCreateTableRequestWithDefaults() *CreateTableRequest {
33+
this := CreateTableRequest{}
34+
return &this
35+
}
36+
37+
// GetData returns the Data field value if set, zero value otherwise.
38+
func (o *CreateTableRequest) GetData() CreateTableRequestData {
39+
if o == nil || o.Data == nil {
40+
var ret CreateTableRequestData
41+
return ret
42+
}
43+
return *o.Data
44+
}
45+
46+
// GetDataOk returns a tuple with the Data field value if set, nil otherwise
47+
// and a boolean to check if the value has been set.
48+
func (o *CreateTableRequest) GetDataOk() (*CreateTableRequestData, bool) {
49+
if o == nil || o.Data == nil {
50+
return nil, false
51+
}
52+
return o.Data, true
53+
}
54+
55+
// HasData returns a boolean if a field has been set.
56+
func (o *CreateTableRequest) HasData() bool {
57+
return o != nil && o.Data != nil
58+
}
59+
60+
// SetData gets a reference to the given CreateTableRequestData and assigns it to the Data field.
61+
func (o *CreateTableRequest) SetData(v CreateTableRequestData) {
62+
o.Data = &v
63+
}
64+
65+
// MarshalJSON serializes the struct using spec logic.
66+
func (o CreateTableRequest) MarshalJSON() ([]byte, error) {
67+
toSerialize := map[string]interface{}{}
68+
if o.UnparsedObject != nil {
69+
return datadog.Marshal(o.UnparsedObject)
70+
}
71+
if o.Data != nil {
72+
toSerialize["data"] = o.Data
73+
}
74+
75+
for key, value := range o.AdditionalProperties {
76+
toSerialize[key] = value
77+
}
78+
return datadog.Marshal(toSerialize)
79+
}
80+
81+
// UnmarshalJSON deserializes the given payload.
82+
func (o *CreateTableRequest) UnmarshalJSON(bytes []byte) (err error) {
83+
all := struct {
84+
Data *CreateTableRequestData `json:"data,omitempty"`
85+
}{}
86+
if err = datadog.Unmarshal(bytes, &all); err != nil {
87+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
88+
}
89+
additionalProperties := make(map[string]interface{})
90+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
91+
datadog.DeleteKeys(additionalProperties, &[]string{"data"})
92+
} else {
93+
return err
94+
}
95+
96+
hasInvalidField := false
97+
if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil {
98+
hasInvalidField = true
99+
}
100+
o.Data = all.Data
101+
102+
if len(additionalProperties) > 0 {
103+
o.AdditionalProperties = additionalProperties
104+
}
105+
106+
if hasInvalidField {
107+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
108+
}
109+
110+
return nil
111+
}
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
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 datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// CreateTableRequestData The definition of `CreateTableRequestData` object.
14+
type CreateTableRequestData struct {
15+
// The definition of `CreateTableRequestDataAttributes` object.
16+
Attributes *CreateTableRequestDataAttributes `json:"attributes,omitempty"`
17+
// The ID of the reference table.
18+
Id *string `json:"id,omitempty"`
19+
// Reference table resource type.
20+
Type CreateTableRequestDataType `json:"type"`
21+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
22+
UnparsedObject map[string]interface{} `json:"-"`
23+
AdditionalProperties map[string]interface{} `json:"-"`
24+
}
25+
26+
// NewCreateTableRequestData instantiates a new CreateTableRequestData object.
27+
// This constructor will assign default values to properties that have it defined,
28+
// and makes sure properties required by API are set, but the set of arguments
29+
// will change when the set of required properties is changed.
30+
func NewCreateTableRequestData(typeVar CreateTableRequestDataType) *CreateTableRequestData {
31+
this := CreateTableRequestData{}
32+
this.Type = typeVar
33+
return &this
34+
}
35+
36+
// NewCreateTableRequestDataWithDefaults instantiates a new CreateTableRequestData object.
37+
// This constructor will only assign default values to properties that have it defined,
38+
// but it doesn't guarantee that properties required by API are set.
39+
func NewCreateTableRequestDataWithDefaults() *CreateTableRequestData {
40+
this := CreateTableRequestData{}
41+
var typeVar CreateTableRequestDataType = CREATETABLEREQUESTDATATYPE_REFERENCE_TABLE
42+
this.Type = typeVar
43+
return &this
44+
}
45+
46+
// GetAttributes returns the Attributes field value if set, zero value otherwise.
47+
func (o *CreateTableRequestData) GetAttributes() CreateTableRequestDataAttributes {
48+
if o == nil || o.Attributes == nil {
49+
var ret CreateTableRequestDataAttributes
50+
return ret
51+
}
52+
return *o.Attributes
53+
}
54+
55+
// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise
56+
// and a boolean to check if the value has been set.
57+
func (o *CreateTableRequestData) GetAttributesOk() (*CreateTableRequestDataAttributes, bool) {
58+
if o == nil || o.Attributes == nil {
59+
return nil, false
60+
}
61+
return o.Attributes, true
62+
}
63+
64+
// HasAttributes returns a boolean if a field has been set.
65+
func (o *CreateTableRequestData) HasAttributes() bool {
66+
return o != nil && o.Attributes != nil
67+
}
68+
69+
// SetAttributes gets a reference to the given CreateTableRequestDataAttributes and assigns it to the Attributes field.
70+
func (o *CreateTableRequestData) SetAttributes(v CreateTableRequestDataAttributes) {
71+
o.Attributes = &v
72+
}
73+
74+
// GetId returns the Id field value if set, zero value otherwise.
75+
func (o *CreateTableRequestData) GetId() string {
76+
if o == nil || o.Id == nil {
77+
var ret string
78+
return ret
79+
}
80+
return *o.Id
81+
}
82+
83+
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
84+
// and a boolean to check if the value has been set.
85+
func (o *CreateTableRequestData) GetIdOk() (*string, bool) {
86+
if o == nil || o.Id == nil {
87+
return nil, false
88+
}
89+
return o.Id, true
90+
}
91+
92+
// HasId returns a boolean if a field has been set.
93+
func (o *CreateTableRequestData) HasId() bool {
94+
return o != nil && o.Id != nil
95+
}
96+
97+
// SetId gets a reference to the given string and assigns it to the Id field.
98+
func (o *CreateTableRequestData) SetId(v string) {
99+
o.Id = &v
100+
}
101+
102+
// GetType returns the Type field value.
103+
func (o *CreateTableRequestData) GetType() CreateTableRequestDataType {
104+
if o == nil {
105+
var ret CreateTableRequestDataType
106+
return ret
107+
}
108+
return o.Type
109+
}
110+
111+
// GetTypeOk returns a tuple with the Type field value
112+
// and a boolean to check if the value has been set.
113+
func (o *CreateTableRequestData) GetTypeOk() (*CreateTableRequestDataType, bool) {
114+
if o == nil {
115+
return nil, false
116+
}
117+
return &o.Type, true
118+
}
119+
120+
// SetType sets field value.
121+
func (o *CreateTableRequestData) SetType(v CreateTableRequestDataType) {
122+
o.Type = v
123+
}
124+
125+
// MarshalJSON serializes the struct using spec logic.
126+
func (o CreateTableRequestData) MarshalJSON() ([]byte, error) {
127+
toSerialize := map[string]interface{}{}
128+
if o.UnparsedObject != nil {
129+
return datadog.Marshal(o.UnparsedObject)
130+
}
131+
if o.Attributes != nil {
132+
toSerialize["attributes"] = o.Attributes
133+
}
134+
if o.Id != nil {
135+
toSerialize["id"] = o.Id
136+
}
137+
toSerialize["type"] = o.Type
138+
139+
for key, value := range o.AdditionalProperties {
140+
toSerialize[key] = value
141+
}
142+
return datadog.Marshal(toSerialize)
143+
}
144+
145+
// UnmarshalJSON deserializes the given payload.
146+
func (o *CreateTableRequestData) UnmarshalJSON(bytes []byte) (err error) {
147+
all := struct {
148+
Attributes *CreateTableRequestDataAttributes `json:"attributes,omitempty"`
149+
Id *string `json:"id,omitempty"`
150+
Type *CreateTableRequestDataType `json:"type"`
151+
}{}
152+
if err = datadog.Unmarshal(bytes, &all); err != nil {
153+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
154+
}
155+
if all.Type == nil {
156+
return fmt.Errorf("required field type missing")
157+
}
158+
additionalProperties := make(map[string]interface{})
159+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
160+
datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"})
161+
} else {
162+
return err
163+
}
164+
165+
hasInvalidField := false
166+
if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
167+
hasInvalidField = true
168+
}
169+
o.Attributes = all.Attributes
170+
o.Id = all.Id
171+
if !all.Type.IsValid() {
172+
hasInvalidField = true
173+
} else {
174+
o.Type = *all.Type
175+
}
176+
177+
if len(additionalProperties) > 0 {
178+
o.AdditionalProperties = additionalProperties
179+
}
180+
181+
if hasInvalidField {
182+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
183+
}
184+
185+
return nil
186+
}

0 commit comments

Comments
 (0)