Skip to content

Commit

Permalink
Regenerate client from commit 4e5906d6 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jan 17, 2025
1 parent d448669 commit d446b97
Show file tree
Hide file tree
Showing 17 changed files with 201 additions and 89 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-17 19:31:45.844559",
"spec_repo_commit": "45186abe"
"regenerated": "2025-01-17 20:19:17.905332",
"spec_repo_commit": "4e5906d6"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-17 19:31:45.861133",
"spec_repo_commit": "45186abe"
"regenerated": "2025-01-17 20:19:17.920625",
"spec_repo_commit": "4e5906d6"
}
}
}
11 changes: 11 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7378,9 +7378,20 @@ components:
properties:
attributes:
$ref: '#/components/schemas/CreateDataDeletionRequestBodyAttributes'
type:
$ref: '#/components/schemas/CreateDataDeletionRequestBodyDataType'
required:
- attributes
- type
type: object
CreateDataDeletionRequestBodyDataType:
description: The deletion request type.
enum:
- create_deletion_req
example: create_deletion_req
type: string
x-enum-varnames:
- CREATE_DELETION_REQ
CreateDataDeletionResponseBody:
description: The response from the create data deletion request endpoint.
properties:
Expand Down
40 changes: 38 additions & 2 deletions api/datadogV2/model_create_data_deletion_request_body_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
type CreateDataDeletionRequestBodyData struct {
// Attributes for creating a data deletion request.
Attributes CreateDataDeletionRequestBodyAttributes `json:"attributes"`
// The deletion request type.
Type CreateDataDeletionRequestBodyDataType `json:"type"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
Expand All @@ -23,9 +25,10 @@ type CreateDataDeletionRequestBodyData struct {
// 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 NewCreateDataDeletionRequestBodyData(attributes CreateDataDeletionRequestBodyAttributes) *CreateDataDeletionRequestBodyData {
func NewCreateDataDeletionRequestBodyData(attributes CreateDataDeletionRequestBodyAttributes, typeVar CreateDataDeletionRequestBodyDataType) *CreateDataDeletionRequestBodyData {
this := CreateDataDeletionRequestBodyData{}
this.Attributes = attributes
this.Type = typeVar
return &this
}

Expand Down Expand Up @@ -60,13 +63,37 @@ func (o *CreateDataDeletionRequestBodyData) SetAttributes(v CreateDataDeletionRe
o.Attributes = v
}

// GetType returns the Type field value.
func (o *CreateDataDeletionRequestBodyData) GetType() CreateDataDeletionRequestBodyDataType {
if o == nil {
var ret CreateDataDeletionRequestBodyDataType
return ret
}
return o.Type
}

// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *CreateDataDeletionRequestBodyData) GetTypeOk() (*CreateDataDeletionRequestBodyDataType, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}

// SetType sets field value.
func (o *CreateDataDeletionRequestBodyData) SetType(v CreateDataDeletionRequestBodyDataType) {
o.Type = v
}

// MarshalJSON serializes the struct using spec logic.
func (o CreateDataDeletionRequestBodyData) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["attributes"] = o.Attributes
toSerialize["type"] = o.Type

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
Expand All @@ -78,16 +105,20 @@ func (o CreateDataDeletionRequestBodyData) MarshalJSON() ([]byte, error) {
func (o *CreateDataDeletionRequestBodyData) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Attributes *CreateDataDeletionRequestBodyAttributes `json:"attributes"`
Type *CreateDataDeletionRequestBodyDataType `json:"type"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Attributes == nil {
return fmt.Errorf("required field attributes missing")
}
if all.Type == nil {
return fmt.Errorf("required field type missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"attributes"})
datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"})
} else {
return err
}
Expand All @@ -97,6 +128,11 @@ func (o *CreateDataDeletionRequestBodyData) UnmarshalJSON(bytes []byte) (err err
hasInvalidField = true
}
o.Attributes = *all.Attributes
if !all.Type.IsValid() {
hasInvalidField = true
} else {
o.Type = *all.Type
}

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
Expand Down
64 changes: 64 additions & 0 deletions api/datadogV2/model_create_data_deletion_request_body_data_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// CreateDataDeletionRequestBodyDataType The deletion request type.
type CreateDataDeletionRequestBodyDataType string

// List of CreateDataDeletionRequestBodyDataType.
const (
CREATEDATADELETIONREQUESTBODYDATATYPE_CREATE_DELETION_REQ CreateDataDeletionRequestBodyDataType = "create_deletion_req"
)

var allowedCreateDataDeletionRequestBodyDataTypeEnumValues = []CreateDataDeletionRequestBodyDataType{
CREATEDATADELETIONREQUESTBODYDATATYPE_CREATE_DELETION_REQ,
}

// GetAllowedValues reeturns the list of possible values.
func (v *CreateDataDeletionRequestBodyDataType) GetAllowedValues() []CreateDataDeletionRequestBodyDataType {
return allowedCreateDataDeletionRequestBodyDataTypeEnumValues
}

// UnmarshalJSON deserializes the given payload.
func (v *CreateDataDeletionRequestBodyDataType) UnmarshalJSON(src []byte) error {
var value string
err := datadog.Unmarshal(src, &value)
if err != nil {
return err
}
*v = CreateDataDeletionRequestBodyDataType(value)
return nil
}

// NewCreateDataDeletionRequestBodyDataTypeFromValue returns a pointer to a valid CreateDataDeletionRequestBodyDataType
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
func NewCreateDataDeletionRequestBodyDataTypeFromValue(v string) (*CreateDataDeletionRequestBodyDataType, error) {
ev := CreateDataDeletionRequestBodyDataType(v)
if ev.IsValid() {
return &ev, nil
}
return nil, fmt.Errorf("invalid value '%v' for CreateDataDeletionRequestBodyDataType: valid values are %v", v, allowedCreateDataDeletionRequestBodyDataTypeEnumValues)
}

// IsValid return true if the value is valid for the enum, false otherwise.
func (v CreateDataDeletionRequestBodyDataType) IsValid() bool {
for _, existing := range allowedCreateDataDeletionRequestBodyDataTypeEnumValues {
if existing == v {
return true
}
}
return false
}

// Ptr returns reference to CreateDataDeletionRequestBodyDataType value.
func (v CreateDataDeletionRequestBodyDataType) Ptr() *CreateDataDeletionRequestBodyDataType {
return &v
}
1 change: 1 addition & 0 deletions examples/v2/data-deletion/CreateDataDeletionRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func main() {
},
To: 1704063600000,
},
Type: datadogV2.CREATEDATADELETIONREQUESTBODYDATATYPE_CREATE_DELETION_REQ,
},
}
ctx := datadog.NewDefaultContext(context.Background())
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:41.160Z
2025-01-15T14:25:54.929Z
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:41.674Z
2025-01-15T14:26:08.930Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}}
{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000},"type":"create_deletion_req"}}
form: {}
headers:
Accept:
Expand All @@ -12,8 +12,8 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v2/deletion/data/logs
response:
body: '{"data":{"id":"523","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:42.016613164Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:42.016613164Z"}},"meta":{"product":"logs"}}'
body: '{"data":{"id":"753","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:26:09.447960191Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:26:09.447960191Z"}},"meta":{"product":"logs"}}'
code: 200
duration: 0ms
headers:
Expand All @@ -28,10 +28,10 @@ interactions:
- application/json
id: 1
method: PUT
url: https://api.datadoghq.com/api/v2/deletion/requests/523/cancel
url: https://api.datadoghq.com/api/v2/deletion/requests/753/cancel
response:
body: '{"data":{"id":"523","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:42.016613Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:42.384299Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
body: '{"data":{"id":"753","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:26:09.44796Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:26:10.016496Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
code: 200
duration: 0ms
headers:
Expand All @@ -46,10 +46,10 @@ interactions:
- application/json
id: 2
method: PUT
url: https://api.datadoghq.com/api/v2/deletion/requests/523/cancel
url: https://api.datadoghq.com/api/v2/deletion/requests/753/cancel
response:
body: '{"data":{"id":"523","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:42.016613Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:42.384299Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
body: '{"data":{"id":"753","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:26:09.44796Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:26:10.016496Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
code: 200
duration: 0ms
headers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:42.850Z
2025-01-15T14:26:26.195Z
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:43.197Z
2025-01-15T14:27:27.929Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000}}}
{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{"host":"abc","service":"xyz"},"to":1704063600000},"type":"create_deletion_req"}}
form: {}
headers:
Accept:
Expand All @@ -12,8 +12,8 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v2/deletion/data/logs
response:
body: '{"data":{"id":"524","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:43.527574137Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:43.527574137Z"}},"meta":{"product":"logs"}}'
body: '{"data":{"id":"754","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:27:28.457837225Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"pending","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:27:28.457837225Z"}},"meta":{"product":"logs"}}'
code: 200
duration: 0ms
headers:
Expand All @@ -28,10 +28,10 @@ interactions:
- application/json
id: 1
method: PUT
url: https://api.datadoghq.com/api/v2/deletion/requests/524/cancel
url: https://api.datadoghq.com/api/v2/deletion/requests/754/cancel
response:
body: '{"data":{"id":"524","type":"deletion_request","attributes":{"created_at":"2024-12-05T09:23:43.527574Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2024-12-05T09:23:44.017414Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
body: '{"data":{"id":"754","type":"deletion_request","attributes":{"created_at":"2025-01-15T14:27:28.457837Z","created_by":"frog@datadoghq.com","from_time":1672527600000,"indexes":["test-index","test-index-2"],"is_created":false,"org_id":321813,"product":"logs","query":"host:abc
service:xyz","starting_at":"0001-01-01T00:00:00Z","status":"canceled","to_time":1704063600000,"total_unrestricted":0,"updated_at":"2025-01-15T14:27:28.841156Z"}},"meta":{"product":"logs","request_status":"canceled"}}'
code: 200
duration: 0ms
headers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:44.038Z
2025-01-15T14:27:45.329Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{},"to":1704063600000}}}
{"data":{"attributes":{"from":1672527600000,"indexes":["test-index","test-index-2"],"query":{},"to":1704063600000},"type":"create_deletion_req"}}
form: {}
headers:
Accept:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-05T09:23:44.395Z
2025-01-15T14:28:03.053Z
Loading

0 comments on commit d446b97

Please sign in to comment.