Skip to content

Commit b363b28

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add documentation for GET, POST, PATCH, and DELETE api/v2/incidents/incident_id/attachments endpoints (#3508)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent f78155d commit b363b28

50 files changed

Lines changed: 2816 additions & 2065 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: 338 additions & 307 deletions
Large diffs are not rendered by default.

api/datadog/configuration.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,12 +661,14 @@ func NewConfiguration() *Configuration {
661661
"v2.UpdateDeploymentGate": false,
662662
"v2.UpdateDeploymentRule": false,
663663
"v2.CreateIncident": false,
664+
"v2.CreateIncidentAttachment": false,
664665
"v2.CreateIncidentIntegration": false,
665666
"v2.CreateIncidentNotificationRule": false,
666667
"v2.CreateIncidentNotificationTemplate": false,
667668
"v2.CreateIncidentTodo": false,
668669
"v2.CreateIncidentType": false,
669670
"v2.DeleteIncident": false,
671+
"v2.DeleteIncidentAttachment": false,
670672
"v2.DeleteIncidentIntegration": false,
671673
"v2.DeleteIncidentNotificationRule": false,
672674
"v2.DeleteIncidentNotificationTemplate": false,
@@ -687,7 +689,7 @@ func NewConfiguration() *Configuration {
687689
"v2.ListIncidentTypes": false,
688690
"v2.SearchIncidents": false,
689691
"v2.UpdateIncident": false,
690-
"v2.UpdateIncidentAttachments": false,
692+
"v2.UpdateIncidentAttachment": false,
691693
"v2.UpdateIncidentIntegration": false,
692694
"v2.UpdateIncidentNotificationRule": false,
693695
"v2.UpdateIncidentNotificationTemplate": false,

api/datadogV2/api_incidents.go

Lines changed: 232 additions & 37 deletions
Large diffs are not rendered by default.

api/datadogV2/doc.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,15 @@
291291
// - [IncidentTeamsApi.ListIncidentTeams]
292292
// - [IncidentTeamsApi.UpdateIncidentTeam]
293293
// - [IncidentsApi.CreateIncident]
294+
// - [IncidentsApi.CreateIncidentAttachment]
294295
// - [IncidentsApi.CreateIncidentImpact]
295296
// - [IncidentsApi.CreateIncidentIntegration]
296297
// - [IncidentsApi.CreateIncidentNotificationRule]
297298
// - [IncidentsApi.CreateIncidentNotificationTemplate]
298299
// - [IncidentsApi.CreateIncidentTodo]
299300
// - [IncidentsApi.CreateIncidentType]
300301
// - [IncidentsApi.DeleteIncident]
302+
// - [IncidentsApi.DeleteIncidentAttachment]
301303
// - [IncidentsApi.DeleteIncidentImpact]
302304
// - [IncidentsApi.DeleteIncidentIntegration]
303305
// - [IncidentsApi.DeleteIncidentNotificationRule]
@@ -320,7 +322,7 @@
320322
// - [IncidentsApi.ListIncidents]
321323
// - [IncidentsApi.SearchIncidents]
322324
// - [IncidentsApi.UpdateIncident]
323-
// - [IncidentsApi.UpdateIncidentAttachments]
325+
// - [IncidentsApi.UpdateIncidentAttachment]
324326
// - [IncidentsApi.UpdateIncidentIntegration]
325327
// - [IncidentsApi.UpdateIncidentNotificationRule]
326328
// - [IncidentsApi.UpdateIncidentNotificationTemplate]

api/datadogV2/model_incident_attachment_update_response.go renamed to api/datadogV2/model_attachment.go

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,99 +5,102 @@
55
package datadogV2
66

77
import (
8-
"fmt"
9-
108
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
119
)
1210

13-
// IncidentAttachmentUpdateResponse The response object containing the created or updated incident attachments.
14-
type IncidentAttachmentUpdateResponse struct {
15-
// An array of incident attachments. Only the attachments that were created or updated by the request are
16-
// returned.
17-
Data []IncidentAttachmentData `json:"data"`
18-
// Included related resources that the user requested.
19-
Included []IncidentAttachmentsResponseIncludedItem `json:"included,omitempty"`
11+
// Attachment
12+
type Attachment struct {
13+
//
14+
Data *AttachmentData `json:"data,omitempty"`
15+
//
16+
Included []AttachmentIncluded `json:"included,omitempty"`
2017
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2118
UnparsedObject map[string]interface{} `json:"-"`
2219
AdditionalProperties map[string]interface{} `json:"-"`
2320
}
2421

25-
// NewIncidentAttachmentUpdateResponse instantiates a new IncidentAttachmentUpdateResponse object.
22+
// NewAttachment instantiates a new Attachment object.
2623
// This constructor will assign default values to properties that have it defined,
2724
// and makes sure properties required by API are set, but the set of arguments
2825
// will change when the set of required properties is changed.
29-
func NewIncidentAttachmentUpdateResponse(data []IncidentAttachmentData) *IncidentAttachmentUpdateResponse {
30-
this := IncidentAttachmentUpdateResponse{}
31-
this.Data = data
26+
func NewAttachment() *Attachment {
27+
this := Attachment{}
3228
return &this
3329
}
3430

35-
// NewIncidentAttachmentUpdateResponseWithDefaults instantiates a new IncidentAttachmentUpdateResponse object.
31+
// NewAttachmentWithDefaults instantiates a new Attachment object.
3632
// This constructor will only assign default values to properties that have it defined,
3733
// but it doesn't guarantee that properties required by API are set.
38-
func NewIncidentAttachmentUpdateResponseWithDefaults() *IncidentAttachmentUpdateResponse {
39-
this := IncidentAttachmentUpdateResponse{}
34+
func NewAttachmentWithDefaults() *Attachment {
35+
this := Attachment{}
4036
return &this
4137
}
4238

43-
// GetData returns the Data field value.
44-
func (o *IncidentAttachmentUpdateResponse) GetData() []IncidentAttachmentData {
45-
if o == nil {
46-
var ret []IncidentAttachmentData
39+
// GetData returns the Data field value if set, zero value otherwise.
40+
func (o *Attachment) GetData() AttachmentData {
41+
if o == nil || o.Data == nil {
42+
var ret AttachmentData
4743
return ret
4844
}
49-
return o.Data
45+
return *o.Data
5046
}
5147

52-
// GetDataOk returns a tuple with the Data field value
48+
// GetDataOk returns a tuple with the Data field value if set, nil otherwise
5349
// and a boolean to check if the value has been set.
54-
func (o *IncidentAttachmentUpdateResponse) GetDataOk() (*[]IncidentAttachmentData, bool) {
55-
if o == nil {
50+
func (o *Attachment) GetDataOk() (*AttachmentData, bool) {
51+
if o == nil || o.Data == nil {
5652
return nil, false
5753
}
58-
return &o.Data, true
54+
return o.Data, true
55+
}
56+
57+
// HasData returns a boolean if a field has been set.
58+
func (o *Attachment) HasData() bool {
59+
return o != nil && o.Data != nil
5960
}
6061

61-
// SetData sets field value.
62-
func (o *IncidentAttachmentUpdateResponse) SetData(v []IncidentAttachmentData) {
63-
o.Data = v
62+
// SetData gets a reference to the given AttachmentData and assigns it to the Data field.
63+
func (o *Attachment) SetData(v AttachmentData) {
64+
o.Data = &v
6465
}
6566

6667
// GetIncluded returns the Included field value if set, zero value otherwise.
67-
func (o *IncidentAttachmentUpdateResponse) GetIncluded() []IncidentAttachmentsResponseIncludedItem {
68+
func (o *Attachment) GetIncluded() []AttachmentIncluded {
6869
if o == nil || o.Included == nil {
69-
var ret []IncidentAttachmentsResponseIncludedItem
70+
var ret []AttachmentIncluded
7071
return ret
7172
}
7273
return o.Included
7374
}
7475

7576
// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise
7677
// and a boolean to check if the value has been set.
77-
func (o *IncidentAttachmentUpdateResponse) GetIncludedOk() (*[]IncidentAttachmentsResponseIncludedItem, bool) {
78+
func (o *Attachment) GetIncludedOk() (*[]AttachmentIncluded, bool) {
7879
if o == nil || o.Included == nil {
7980
return nil, false
8081
}
8182
return &o.Included, true
8283
}
8384

8485
// HasIncluded returns a boolean if a field has been set.
85-
func (o *IncidentAttachmentUpdateResponse) HasIncluded() bool {
86+
func (o *Attachment) HasIncluded() bool {
8687
return o != nil && o.Included != nil
8788
}
8889

89-
// SetIncluded gets a reference to the given []IncidentAttachmentsResponseIncludedItem and assigns it to the Included field.
90-
func (o *IncidentAttachmentUpdateResponse) SetIncluded(v []IncidentAttachmentsResponseIncludedItem) {
90+
// SetIncluded gets a reference to the given []AttachmentIncluded and assigns it to the Included field.
91+
func (o *Attachment) SetIncluded(v []AttachmentIncluded) {
9192
o.Included = v
9293
}
9394

9495
// MarshalJSON serializes the struct using spec logic.
95-
func (o IncidentAttachmentUpdateResponse) MarshalJSON() ([]byte, error) {
96+
func (o Attachment) MarshalJSON() ([]byte, error) {
9697
toSerialize := map[string]interface{}{}
9798
if o.UnparsedObject != nil {
9899
return datadog.Marshal(o.UnparsedObject)
99100
}
100-
toSerialize["data"] = o.Data
101+
if o.Data != nil {
102+
toSerialize["data"] = o.Data
103+
}
101104
if o.Included != nil {
102105
toSerialize["included"] = o.Included
103106
}
@@ -109,29 +112,35 @@ func (o IncidentAttachmentUpdateResponse) MarshalJSON() ([]byte, error) {
109112
}
110113

111114
// UnmarshalJSON deserializes the given payload.
112-
func (o *IncidentAttachmentUpdateResponse) UnmarshalJSON(bytes []byte) (err error) {
115+
func (o *Attachment) UnmarshalJSON(bytes []byte) (err error) {
113116
all := struct {
114-
Data *[]IncidentAttachmentData `json:"data"`
115-
Included []IncidentAttachmentsResponseIncludedItem `json:"included,omitempty"`
117+
Data *AttachmentData `json:"data,omitempty"`
118+
Included []AttachmentIncluded `json:"included,omitempty"`
116119
}{}
117120
if err = datadog.Unmarshal(bytes, &all); err != nil {
118121
return datadog.Unmarshal(bytes, &o.UnparsedObject)
119122
}
120-
if all.Data == nil {
121-
return fmt.Errorf("required field data missing")
122-
}
123123
additionalProperties := make(map[string]interface{})
124124
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
125125
datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"})
126126
} else {
127127
return err
128128
}
129-
o.Data = *all.Data
129+
130+
hasInvalidField := false
131+
if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil {
132+
hasInvalidField = true
133+
}
134+
o.Data = all.Data
130135
o.Included = all.Included
131136

132137
if len(additionalProperties) > 0 {
133138
o.AdditionalProperties = additionalProperties
134139
}
135140

141+
if hasInvalidField {
142+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
143+
}
144+
136145
return nil
137146
}

api/datadogV2/model_incident_attachments_response.go renamed to api/datadogV2/model_attachment_array.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,88 +10,88 @@ import (
1010
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
1111
)
1212

13-
// IncidentAttachmentsResponse The response object containing an incident's attachments.
14-
type IncidentAttachmentsResponse struct {
15-
// An array of incident attachments.
16-
Data []IncidentAttachmentData `json:"data"`
17-
// Included related resources that the user requested.
18-
Included []IncidentAttachmentsResponseIncludedItem `json:"included,omitempty"`
13+
// AttachmentArray
14+
type AttachmentArray struct {
15+
//
16+
Data []AttachmentData `json:"data"`
17+
//
18+
Included []AttachmentIncluded `json:"included,omitempty"`
1919
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2020
UnparsedObject map[string]interface{} `json:"-"`
2121
AdditionalProperties map[string]interface{} `json:"-"`
2222
}
2323

24-
// NewIncidentAttachmentsResponse instantiates a new IncidentAttachmentsResponse object.
24+
// NewAttachmentArray instantiates a new AttachmentArray object.
2525
// This constructor will assign default values to properties that have it defined,
2626
// and makes sure properties required by API are set, but the set of arguments
2727
// will change when the set of required properties is changed.
28-
func NewIncidentAttachmentsResponse(data []IncidentAttachmentData) *IncidentAttachmentsResponse {
29-
this := IncidentAttachmentsResponse{}
28+
func NewAttachmentArray(data []AttachmentData) *AttachmentArray {
29+
this := AttachmentArray{}
3030
this.Data = data
3131
return &this
3232
}
3333

34-
// NewIncidentAttachmentsResponseWithDefaults instantiates a new IncidentAttachmentsResponse object.
34+
// NewAttachmentArrayWithDefaults instantiates a new AttachmentArray object.
3535
// This constructor will only assign default values to properties that have it defined,
3636
// but it doesn't guarantee that properties required by API are set.
37-
func NewIncidentAttachmentsResponseWithDefaults() *IncidentAttachmentsResponse {
38-
this := IncidentAttachmentsResponse{}
37+
func NewAttachmentArrayWithDefaults() *AttachmentArray {
38+
this := AttachmentArray{}
3939
return &this
4040
}
4141

4242
// GetData returns the Data field value.
43-
func (o *IncidentAttachmentsResponse) GetData() []IncidentAttachmentData {
43+
func (o *AttachmentArray) GetData() []AttachmentData {
4444
if o == nil {
45-
var ret []IncidentAttachmentData
45+
var ret []AttachmentData
4646
return ret
4747
}
4848
return o.Data
4949
}
5050

5151
// GetDataOk returns a tuple with the Data field value
5252
// and a boolean to check if the value has been set.
53-
func (o *IncidentAttachmentsResponse) GetDataOk() (*[]IncidentAttachmentData, bool) {
53+
func (o *AttachmentArray) GetDataOk() (*[]AttachmentData, bool) {
5454
if o == nil {
5555
return nil, false
5656
}
5757
return &o.Data, true
5858
}
5959

6060
// SetData sets field value.
61-
func (o *IncidentAttachmentsResponse) SetData(v []IncidentAttachmentData) {
61+
func (o *AttachmentArray) SetData(v []AttachmentData) {
6262
o.Data = v
6363
}
6464

6565
// GetIncluded returns the Included field value if set, zero value otherwise.
66-
func (o *IncidentAttachmentsResponse) GetIncluded() []IncidentAttachmentsResponseIncludedItem {
66+
func (o *AttachmentArray) GetIncluded() []AttachmentIncluded {
6767
if o == nil || o.Included == nil {
68-
var ret []IncidentAttachmentsResponseIncludedItem
68+
var ret []AttachmentIncluded
6969
return ret
7070
}
7171
return o.Included
7272
}
7373

7474
// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise
7575
// and a boolean to check if the value has been set.
76-
func (o *IncidentAttachmentsResponse) GetIncludedOk() (*[]IncidentAttachmentsResponseIncludedItem, bool) {
76+
func (o *AttachmentArray) GetIncludedOk() (*[]AttachmentIncluded, bool) {
7777
if o == nil || o.Included == nil {
7878
return nil, false
7979
}
8080
return &o.Included, true
8181
}
8282

8383
// HasIncluded returns a boolean if a field has been set.
84-
func (o *IncidentAttachmentsResponse) HasIncluded() bool {
84+
func (o *AttachmentArray) HasIncluded() bool {
8585
return o != nil && o.Included != nil
8686
}
8787

88-
// SetIncluded gets a reference to the given []IncidentAttachmentsResponseIncludedItem and assigns it to the Included field.
89-
func (o *IncidentAttachmentsResponse) SetIncluded(v []IncidentAttachmentsResponseIncludedItem) {
88+
// SetIncluded gets a reference to the given []AttachmentIncluded and assigns it to the Included field.
89+
func (o *AttachmentArray) SetIncluded(v []AttachmentIncluded) {
9090
o.Included = v
9191
}
9292

9393
// MarshalJSON serializes the struct using spec logic.
94-
func (o IncidentAttachmentsResponse) MarshalJSON() ([]byte, error) {
94+
func (o AttachmentArray) MarshalJSON() ([]byte, error) {
9595
toSerialize := map[string]interface{}{}
9696
if o.UnparsedObject != nil {
9797
return datadog.Marshal(o.UnparsedObject)
@@ -108,10 +108,10 @@ func (o IncidentAttachmentsResponse) MarshalJSON() ([]byte, error) {
108108
}
109109

110110
// UnmarshalJSON deserializes the given payload.
111-
func (o *IncidentAttachmentsResponse) UnmarshalJSON(bytes []byte) (err error) {
111+
func (o *AttachmentArray) UnmarshalJSON(bytes []byte) (err error) {
112112
all := struct {
113-
Data *[]IncidentAttachmentData `json:"data"`
114-
Included []IncidentAttachmentsResponseIncludedItem `json:"included,omitempty"`
113+
Data *[]AttachmentData `json:"data"`
114+
Included []AttachmentIncluded `json:"included,omitempty"`
115115
}{}
116116
if err = datadog.Unmarshal(bytes, &all); err != nil {
117117
return datadog.Unmarshal(bytes, &o.UnparsedObject)

0 commit comments

Comments
 (0)