Skip to content

Commit 52febbc

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Enable auto-merging for keys routes. (#2634)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 423dfaa commit 52febbc

10 files changed

+686
-32
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-08-14 22:02:33.356148",
8-
"spec_repo_commit": "5e33062a"
7+
"regenerated": "2024-08-14 22:32:02.181891",
8+
"spec_repo_commit": "07d72513"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-08-14 22:02:33.380397",
13-
"spec_repo_commit": "5e33062a"
12+
"regenerated": "2024-08-14 22:32:02.200367",
13+
"spec_repo_commit": "07d72513"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,10 +673,16 @@ components:
673673
APIKeyCreateAttributes:
674674
description: Attributes used to create an API Key.
675675
properties:
676+
category:
677+
description: The APIKeyCreateAttributes category.
678+
type: string
676679
name:
677680
description: Name of the API key.
678681
example: API Key for submitting metrics
679682
type: string
683+
remote_config_read_enabled:
684+
description: The APIKeyCreateAttributes remote_config_read_enabled.
685+
type: boolean
680686
required:
681687
- name
682688
type: object
@@ -722,13 +728,20 @@ components:
722728
description: An object related to an API key.
723729
oneOf:
724730
- $ref: '#/components/schemas/User'
731+
- $ref: '#/components/schemas/LeakedKey'
725732
APIKeyUpdateAttributes:
726733
description: Attributes used to update an API Key.
727734
properties:
735+
category:
736+
description: The APIKeyUpdateAttributes category.
737+
type: string
728738
name:
729739
description: Name of the API key.
730740
example: API Key for submitting metrics
731741
type: string
742+
remote_config_read_enabled:
743+
description: The APIKeyUpdateAttributes remote_config_read_enabled.
744+
type: boolean
732745
required:
733746
- name
734747
type: object
@@ -981,6 +994,7 @@ components:
981994
oneOf:
982995
- $ref: '#/components/schemas/User'
983996
- $ref: '#/components/schemas/Role'
997+
- $ref: '#/components/schemas/LeakedKey'
984998
ApplicationKeyResponseMeta:
985999
description: Additional information related to the application key response.
9861000
properties:
@@ -8461,6 +8475,7 @@ components:
84618475
created_at:
84628476
description: Creation date of the API key.
84638477
example: '2020-11-23T10:00:00.000Z'
8478+
format: date-time
84648479
readOnly: true
84658480
type: string
84668481
key:
@@ -8477,6 +8492,7 @@ components:
84778492
modified_at:
84788493
description: Date the API key was last modified.
84798494
example: '2020-11-23T10:00:00.000Z'
8495+
format: date-time
84808496
readOnly: true
84818497
type: string
84828498
name:
@@ -11140,6 +11156,45 @@ components:
1114011156
description: Jira project key
1114111157
type: string
1114211158
type: object
11159+
LeakedKey:
11160+
description: The definition of LeakedKey object.
11161+
properties:
11162+
attributes:
11163+
$ref: '#/components/schemas/LeakedKeyAttributes'
11164+
id:
11165+
description: The LeakedKey id.
11166+
example: id
11167+
type: string
11168+
type:
11169+
$ref: '#/components/schemas/LeakedKeyType'
11170+
required:
11171+
- attributes
11172+
- id
11173+
- type
11174+
type: object
11175+
LeakedKeyAttributes:
11176+
description: The definition of LeakedKeyAttributes object.
11177+
properties:
11178+
date:
11179+
description: The LeakedKeyAttributes date.
11180+
example: '2017-07-21T17:32:28Z'
11181+
format: date-time
11182+
type: string
11183+
leak_source:
11184+
description: The LeakedKeyAttributes leak_source.
11185+
type: string
11186+
required:
11187+
- date
11188+
type: object
11189+
LeakedKeyType:
11190+
default: leaked_keys
11191+
description: The definition of LeakedKeyType object.
11192+
enum:
11193+
- leaked_keys
11194+
example: leaked_keys
11195+
type: string
11196+
x-enum-varnames:
11197+
- LEAKED_KEYS
1114311198
ListAPIsResponse:
1114411199
description: Response for `ListAPIs`.
1114511200
properties:

api/datadogV2/model_api_key_create_attributes.go

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ import (
1212

1313
// APIKeyCreateAttributes Attributes used to create an API Key.
1414
type APIKeyCreateAttributes struct {
15+
// The APIKeyCreateAttributes category.
16+
Category *string `json:"category,omitempty"`
1517
// Name of the API key.
1618
Name string `json:"name"`
19+
// The APIKeyCreateAttributes remote_config_read_enabled.
20+
RemoteConfigReadEnabled *bool `json:"remote_config_read_enabled,omitempty"`
1721
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1822
UnparsedObject map[string]interface{} `json:"-"`
1923
AdditionalProperties map[string]interface{} `json:"-"`
@@ -37,6 +41,34 @@ func NewAPIKeyCreateAttributesWithDefaults() *APIKeyCreateAttributes {
3741
return &this
3842
}
3943

44+
// GetCategory returns the Category field value if set, zero value otherwise.
45+
func (o *APIKeyCreateAttributes) GetCategory() string {
46+
if o == nil || o.Category == nil {
47+
var ret string
48+
return ret
49+
}
50+
return *o.Category
51+
}
52+
53+
// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise
54+
// and a boolean to check if the value has been set.
55+
func (o *APIKeyCreateAttributes) GetCategoryOk() (*string, bool) {
56+
if o == nil || o.Category == nil {
57+
return nil, false
58+
}
59+
return o.Category, true
60+
}
61+
62+
// HasCategory returns a boolean if a field has been set.
63+
func (o *APIKeyCreateAttributes) HasCategory() bool {
64+
return o != nil && o.Category != nil
65+
}
66+
67+
// SetCategory gets a reference to the given string and assigns it to the Category field.
68+
func (o *APIKeyCreateAttributes) SetCategory(v string) {
69+
o.Category = &v
70+
}
71+
4072
// GetName returns the Name field value.
4173
func (o *APIKeyCreateAttributes) GetName() string {
4274
if o == nil {
@@ -60,13 +92,47 @@ func (o *APIKeyCreateAttributes) SetName(v string) {
6092
o.Name = v
6193
}
6294

95+
// GetRemoteConfigReadEnabled returns the RemoteConfigReadEnabled field value if set, zero value otherwise.
96+
func (o *APIKeyCreateAttributes) GetRemoteConfigReadEnabled() bool {
97+
if o == nil || o.RemoteConfigReadEnabled == nil {
98+
var ret bool
99+
return ret
100+
}
101+
return *o.RemoteConfigReadEnabled
102+
}
103+
104+
// GetRemoteConfigReadEnabledOk returns a tuple with the RemoteConfigReadEnabled field value if set, nil otherwise
105+
// and a boolean to check if the value has been set.
106+
func (o *APIKeyCreateAttributes) GetRemoteConfigReadEnabledOk() (*bool, bool) {
107+
if o == nil || o.RemoteConfigReadEnabled == nil {
108+
return nil, false
109+
}
110+
return o.RemoteConfigReadEnabled, true
111+
}
112+
113+
// HasRemoteConfigReadEnabled returns a boolean if a field has been set.
114+
func (o *APIKeyCreateAttributes) HasRemoteConfigReadEnabled() bool {
115+
return o != nil && o.RemoteConfigReadEnabled != nil
116+
}
117+
118+
// SetRemoteConfigReadEnabled gets a reference to the given bool and assigns it to the RemoteConfigReadEnabled field.
119+
func (o *APIKeyCreateAttributes) SetRemoteConfigReadEnabled(v bool) {
120+
o.RemoteConfigReadEnabled = &v
121+
}
122+
63123
// MarshalJSON serializes the struct using spec logic.
64124
func (o APIKeyCreateAttributes) MarshalJSON() ([]byte, error) {
65125
toSerialize := map[string]interface{}{}
66126
if o.UnparsedObject != nil {
67127
return datadog.Marshal(o.UnparsedObject)
68128
}
129+
if o.Category != nil {
130+
toSerialize["category"] = o.Category
131+
}
69132
toSerialize["name"] = o.Name
133+
if o.RemoteConfigReadEnabled != nil {
134+
toSerialize["remote_config_read_enabled"] = o.RemoteConfigReadEnabled
135+
}
70136

71137
for key, value := range o.AdditionalProperties {
72138
toSerialize[key] = value
@@ -77,7 +143,9 @@ func (o APIKeyCreateAttributes) MarshalJSON() ([]byte, error) {
77143
// UnmarshalJSON deserializes the given payload.
78144
func (o *APIKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) {
79145
all := struct {
80-
Name *string `json:"name"`
146+
Category *string `json:"category,omitempty"`
147+
Name *string `json:"name"`
148+
RemoteConfigReadEnabled *bool `json:"remote_config_read_enabled,omitempty"`
81149
}{}
82150
if err = datadog.Unmarshal(bytes, &all); err != nil {
83151
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -87,11 +155,13 @@ func (o *APIKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) {
87155
}
88156
additionalProperties := make(map[string]interface{})
89157
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
90-
datadog.DeleteKeys(additionalProperties, &[]string{"name"})
158+
datadog.DeleteKeys(additionalProperties, &[]string{"category", "name", "remote_config_read_enabled"})
91159
} else {
92160
return err
93161
}
162+
o.Category = all.Category
94163
o.Name = *all.Name
164+
o.RemoteConfigReadEnabled = all.RemoteConfigReadEnabled
95165

96166
if len(additionalProperties) > 0 {
97167
o.AdditionalProperties = additionalProperties

api/datadogV2/model_api_key_response_included_item.go

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import (
1010

1111
// APIKeyResponseIncludedItem - An object related to an API key.
1212
type APIKeyResponseIncludedItem struct {
13-
User *User
13+
User *User
14+
LeakedKey *LeakedKey
1415

1516
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1617
UnparsedObject interface{}
@@ -21,6 +22,11 @@ func UserAsAPIKeyResponseIncludedItem(v *User) APIKeyResponseIncludedItem {
2122
return APIKeyResponseIncludedItem{User: v}
2223
}
2324

25+
// LeakedKeyAsAPIKeyResponseIncludedItem is a convenience function that returns LeakedKey wrapped in APIKeyResponseIncludedItem.
26+
func LeakedKeyAsAPIKeyResponseIncludedItem(v *LeakedKey) APIKeyResponseIncludedItem {
27+
return APIKeyResponseIncludedItem{LeakedKey: v}
28+
}
29+
2430
// UnmarshalJSON turns data into one of the pointers in the struct.
2531
func (obj *APIKeyResponseIncludedItem) UnmarshalJSON(data []byte) error {
2632
var err error
@@ -42,9 +48,27 @@ func (obj *APIKeyResponseIncludedItem) UnmarshalJSON(data []byte) error {
4248
obj.User = nil
4349
}
4450

51+
// try to unmarshal data into LeakedKey
52+
err = datadog.Unmarshal(data, &obj.LeakedKey)
53+
if err == nil {
54+
if obj.LeakedKey != nil && obj.LeakedKey.UnparsedObject == nil {
55+
jsonLeakedKey, _ := datadog.Marshal(obj.LeakedKey)
56+
if string(jsonLeakedKey) == "{}" { // empty struct
57+
obj.LeakedKey = nil
58+
} else {
59+
match++
60+
}
61+
} else {
62+
obj.LeakedKey = nil
63+
}
64+
} else {
65+
obj.LeakedKey = nil
66+
}
67+
4568
if match != 1 { // more than 1 match
4669
// reset to nil
4770
obj.User = nil
71+
obj.LeakedKey = nil
4872
return datadog.Unmarshal(data, &obj.UnparsedObject)
4973
}
5074
return nil // exactly one match
@@ -56,6 +80,10 @@ func (obj APIKeyResponseIncludedItem) MarshalJSON() ([]byte, error) {
5680
return datadog.Marshal(&obj.User)
5781
}
5882

83+
if obj.LeakedKey != nil {
84+
return datadog.Marshal(&obj.LeakedKey)
85+
}
86+
5987
if obj.UnparsedObject != nil {
6088
return datadog.Marshal(obj.UnparsedObject)
6189
}
@@ -68,6 +96,10 @@ func (obj *APIKeyResponseIncludedItem) GetActualInstance() interface{} {
6896
return obj.User
6997
}
7098

99+
if obj.LeakedKey != nil {
100+
return obj.LeakedKey
101+
}
102+
71103
// all schemas are nil
72104
return nil
73105
}

0 commit comments

Comments
 (0)