Skip to content

Commit 7a854c0

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add action datastore API (#3315)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent f744bac commit 7a854c0

102 files changed

Lines changed: 9025 additions & 0 deletions

File tree

Some content is hidden

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

.generator/schemas/v2/openapi.yaml

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

api/datadogV2/api_actions_datastores.go

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

api/datadogV2/doc.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@
3131
// - [ActionConnectionApi.RegisterAppKey]
3232
// - [ActionConnectionApi.UnregisterAppKey]
3333
// - [ActionConnectionApi.UpdateActionConnection]
34+
// - [ActionsDatastoresApi.BulkWriteDatastoreItems]
35+
// - [ActionsDatastoresApi.CreateDatastore]
36+
// - [ActionsDatastoresApi.DeleteDatastore]
37+
// - [ActionsDatastoresApi.DeleteDatastoreItem]
38+
// - [ActionsDatastoresApi.GetDatastore]
39+
// - [ActionsDatastoresApi.ListDatastoreItems]
40+
// - [ActionsDatastoresApi.ListDatastores]
41+
// - [ActionsDatastoresApi.UpdateDatastore]
42+
// - [ActionsDatastoresApi.UpdateDatastoreItem]
3443
// - [AgentlessScanningApi.CreateAwsOnDemandTask]
3544
// - [AgentlessScanningApi.CreateAwsScanOptions]
3645
// - [AgentlessScanningApi.DeleteAwsScanOptions]
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+
// BulkPutAppsDatastoreItemsRequest Request to insert multiple items into a datastore in a single operation.
12+
type BulkPutAppsDatastoreItemsRequest struct {
13+
// Data wrapper containing the items to insert and their configuration for the bulk insert operation.
14+
Data *BulkPutAppsDatastoreItemsRequestData `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+
// NewBulkPutAppsDatastoreItemsRequest instantiates a new BulkPutAppsDatastoreItemsRequest 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 NewBulkPutAppsDatastoreItemsRequest() *BulkPutAppsDatastoreItemsRequest {
25+
this := BulkPutAppsDatastoreItemsRequest{}
26+
return &this
27+
}
28+
29+
// NewBulkPutAppsDatastoreItemsRequestWithDefaults instantiates a new BulkPutAppsDatastoreItemsRequest 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 NewBulkPutAppsDatastoreItemsRequestWithDefaults() *BulkPutAppsDatastoreItemsRequest {
33+
this := BulkPutAppsDatastoreItemsRequest{}
34+
return &this
35+
}
36+
37+
// GetData returns the Data field value if set, zero value otherwise.
38+
func (o *BulkPutAppsDatastoreItemsRequest) GetData() BulkPutAppsDatastoreItemsRequestData {
39+
if o == nil || o.Data == nil {
40+
var ret BulkPutAppsDatastoreItemsRequestData
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 *BulkPutAppsDatastoreItemsRequest) GetDataOk() (*BulkPutAppsDatastoreItemsRequestData, 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 *BulkPutAppsDatastoreItemsRequest) HasData() bool {
57+
return o != nil && o.Data != nil
58+
}
59+
60+
// SetData gets a reference to the given BulkPutAppsDatastoreItemsRequestData and assigns it to the Data field.
61+
func (o *BulkPutAppsDatastoreItemsRequest) SetData(v BulkPutAppsDatastoreItemsRequestData) {
62+
o.Data = &v
63+
}
64+
65+
// MarshalJSON serializes the struct using spec logic.
66+
func (o BulkPutAppsDatastoreItemsRequest) 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 *BulkPutAppsDatastoreItemsRequest) UnmarshalJSON(bytes []byte) (err error) {
83+
all := struct {
84+
Data *BulkPutAppsDatastoreItemsRequestData `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: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
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+
// BulkPutAppsDatastoreItemsRequestData Data wrapper containing the items to insert and their configuration for the bulk insert operation.
14+
type BulkPutAppsDatastoreItemsRequestData struct {
15+
// Configuration for bulk inserting multiple items into a datastore.
16+
Attributes *BulkPutAppsDatastoreItemsRequestDataAttributes `json:"attributes,omitempty"`
17+
// The resource type for datastore items.
18+
Type DatastoreItemsDataType `json:"type"`
19+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
20+
UnparsedObject map[string]interface{} `json:"-"`
21+
AdditionalProperties map[string]interface{} `json:"-"`
22+
}
23+
24+
// NewBulkPutAppsDatastoreItemsRequestData instantiates a new BulkPutAppsDatastoreItemsRequestData object.
25+
// This constructor will assign default values to properties that have it defined,
26+
// and makes sure properties required by API are set, but the set of arguments
27+
// will change when the set of required properties is changed.
28+
func NewBulkPutAppsDatastoreItemsRequestData(typeVar DatastoreItemsDataType) *BulkPutAppsDatastoreItemsRequestData {
29+
this := BulkPutAppsDatastoreItemsRequestData{}
30+
this.Type = typeVar
31+
return &this
32+
}
33+
34+
// NewBulkPutAppsDatastoreItemsRequestDataWithDefaults instantiates a new BulkPutAppsDatastoreItemsRequestData object.
35+
// This constructor will only assign default values to properties that have it defined,
36+
// but it doesn't guarantee that properties required by API are set.
37+
func NewBulkPutAppsDatastoreItemsRequestDataWithDefaults() *BulkPutAppsDatastoreItemsRequestData {
38+
this := BulkPutAppsDatastoreItemsRequestData{}
39+
var typeVar DatastoreItemsDataType = DATASTOREITEMSDATATYPE_ITEMS
40+
this.Type = typeVar
41+
return &this
42+
}
43+
44+
// GetAttributes returns the Attributes field value if set, zero value otherwise.
45+
func (o *BulkPutAppsDatastoreItemsRequestData) GetAttributes() BulkPutAppsDatastoreItemsRequestDataAttributes {
46+
if o == nil || o.Attributes == nil {
47+
var ret BulkPutAppsDatastoreItemsRequestDataAttributes
48+
return ret
49+
}
50+
return *o.Attributes
51+
}
52+
53+
// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise
54+
// and a boolean to check if the value has been set.
55+
func (o *BulkPutAppsDatastoreItemsRequestData) GetAttributesOk() (*BulkPutAppsDatastoreItemsRequestDataAttributes, bool) {
56+
if o == nil || o.Attributes == nil {
57+
return nil, false
58+
}
59+
return o.Attributes, true
60+
}
61+
62+
// HasAttributes returns a boolean if a field has been set.
63+
func (o *BulkPutAppsDatastoreItemsRequestData) HasAttributes() bool {
64+
return o != nil && o.Attributes != nil
65+
}
66+
67+
// SetAttributes gets a reference to the given BulkPutAppsDatastoreItemsRequestDataAttributes and assigns it to the Attributes field.
68+
func (o *BulkPutAppsDatastoreItemsRequestData) SetAttributes(v BulkPutAppsDatastoreItemsRequestDataAttributes) {
69+
o.Attributes = &v
70+
}
71+
72+
// GetType returns the Type field value.
73+
func (o *BulkPutAppsDatastoreItemsRequestData) GetType() DatastoreItemsDataType {
74+
if o == nil {
75+
var ret DatastoreItemsDataType
76+
return ret
77+
}
78+
return o.Type
79+
}
80+
81+
// GetTypeOk returns a tuple with the Type field value
82+
// and a boolean to check if the value has been set.
83+
func (o *BulkPutAppsDatastoreItemsRequestData) GetTypeOk() (*DatastoreItemsDataType, bool) {
84+
if o == nil {
85+
return nil, false
86+
}
87+
return &o.Type, true
88+
}
89+
90+
// SetType sets field value.
91+
func (o *BulkPutAppsDatastoreItemsRequestData) SetType(v DatastoreItemsDataType) {
92+
o.Type = v
93+
}
94+
95+
// MarshalJSON serializes the struct using spec logic.
96+
func (o BulkPutAppsDatastoreItemsRequestData) MarshalJSON() ([]byte, error) {
97+
toSerialize := map[string]interface{}{}
98+
if o.UnparsedObject != nil {
99+
return datadog.Marshal(o.UnparsedObject)
100+
}
101+
if o.Attributes != nil {
102+
toSerialize["attributes"] = o.Attributes
103+
}
104+
toSerialize["type"] = o.Type
105+
106+
for key, value := range o.AdditionalProperties {
107+
toSerialize[key] = value
108+
}
109+
return datadog.Marshal(toSerialize)
110+
}
111+
112+
// UnmarshalJSON deserializes the given payload.
113+
func (o *BulkPutAppsDatastoreItemsRequestData) UnmarshalJSON(bytes []byte) (err error) {
114+
all := struct {
115+
Attributes *BulkPutAppsDatastoreItemsRequestDataAttributes `json:"attributes,omitempty"`
116+
Type *DatastoreItemsDataType `json:"type"`
117+
}{}
118+
if err = datadog.Unmarshal(bytes, &all); err != nil {
119+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
120+
}
121+
if all.Type == nil {
122+
return fmt.Errorf("required field type missing")
123+
}
124+
additionalProperties := make(map[string]interface{})
125+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
126+
datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"})
127+
} else {
128+
return err
129+
}
130+
131+
hasInvalidField := false
132+
if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
133+
hasInvalidField = true
134+
}
135+
o.Attributes = all.Attributes
136+
if !all.Type.IsValid() {
137+
hasInvalidField = true
138+
} else {
139+
o.Type = *all.Type
140+
}
141+
142+
if len(additionalProperties) > 0 {
143+
o.AdditionalProperties = additionalProperties
144+
}
145+
146+
if hasInvalidField {
147+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
148+
}
149+
150+
return nil
151+
}

0 commit comments

Comments
 (0)