Skip to content

Commit df4670f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add last_used_at to application keys and date_last_used to api keys responses (#3335)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent f633971 commit df4670f

27 files changed

Lines changed: 455 additions & 136 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18761,6 +18761,13 @@ components:
1876118761
format: date-time
1876218762
readOnly: true
1876318763
type: string
18764+
date_last_used:
18765+
description: Date the API Key was last used
18766+
example: '2020-11-27T10:00:00.000Z'
18767+
format: date-time
18768+
nullable: true
18769+
readOnly: true
18770+
type: string
1876418771
key:
1876518772
description: The API key.
1876618773
readOnly: true
@@ -18819,6 +18826,13 @@ components:
1881918826
minLength: 4
1882018827
readOnly: true
1882118828
type: string
18829+
last_used_at:
18830+
description: Last usage timestamp of the application key.
18831+
example: '2020-12-20T10:00:00.000Z'
18832+
format: date-time
18833+
nullable: true
18834+
readOnly: true
18835+
type: string
1882218836
name:
1882318837
description: Name of the application key.
1882418838
example: Application Key for managing dashboards
@@ -34754,6 +34768,13 @@ components:
3475434768
example: '2020-11-23T10:00:00.000Z'
3475534769
readOnly: true
3475634770
type: string
34771+
date_last_used:
34772+
description: Date the API Key was last used.
34773+
example: '2020-11-27T10:00:00.000Z'
34774+
format: date-time
34775+
nullable: true
34776+
readOnly: true
34777+
type: string
3475734778
last4:
3475834779
description: The last four characters of the API key.
3475934780
example: abcd
@@ -34802,6 +34823,12 @@ components:
3480234823
minLength: 4
3480334824
readOnly: true
3480434825
type: string
34826+
last_used_at:
34827+
description: Last usage timestamp of the application key.
34828+
example: '2020-12-20T10:00:00.000Z'
34829+
nullable: true
34830+
readOnly: true
34831+
type: string
3480534832
name:
3480634833
description: Name of the application key.
3480734834
example: Application Key for managing dashboards
@@ -37778,6 +37805,7 @@ components:
3777837805
- type
3777937806
type: object
3778037807
RoleAttributes:
37808+
additionalProperties: {}
3778137809
description: Attributes of the role.
3778237810
properties:
3778337811
created_at:

api/datadogV2/model_full_api_key_attributes.go

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ type FullAPIKeyAttributes struct {
1616
Category *string `json:"category,omitempty"`
1717
// Creation date of the API key.
1818
CreatedAt *time.Time `json:"created_at,omitempty"`
19+
// Date the API Key was last used
20+
DateLastUsed datadog.NullableTime `json:"date_last_used,omitempty"`
1921
// The API key.
2022
Key *string `json:"key,omitempty"`
2123
// The last four characters of the API key.
@@ -104,6 +106,45 @@ func (o *FullAPIKeyAttributes) SetCreatedAt(v time.Time) {
104106
o.CreatedAt = &v
105107
}
106108

109+
// GetDateLastUsed returns the DateLastUsed field value if set, zero value otherwise (both if not set or set to explicit null).
110+
func (o *FullAPIKeyAttributes) GetDateLastUsed() time.Time {
111+
if o == nil || o.DateLastUsed.Get() == nil {
112+
var ret time.Time
113+
return ret
114+
}
115+
return *o.DateLastUsed.Get()
116+
}
117+
118+
// GetDateLastUsedOk returns a tuple with the DateLastUsed field value if set, nil otherwise
119+
// and a boolean to check if the value has been set.
120+
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
121+
func (o *FullAPIKeyAttributes) GetDateLastUsedOk() (*time.Time, bool) {
122+
if o == nil {
123+
return nil, false
124+
}
125+
return o.DateLastUsed.Get(), o.DateLastUsed.IsSet()
126+
}
127+
128+
// HasDateLastUsed returns a boolean if a field has been set.
129+
func (o *FullAPIKeyAttributes) HasDateLastUsed() bool {
130+
return o != nil && o.DateLastUsed.IsSet()
131+
}
132+
133+
// SetDateLastUsed gets a reference to the given datadog.NullableTime and assigns it to the DateLastUsed field.
134+
func (o *FullAPIKeyAttributes) SetDateLastUsed(v time.Time) {
135+
o.DateLastUsed.Set(&v)
136+
}
137+
138+
// SetDateLastUsedNil sets the value for DateLastUsed to be an explicit nil.
139+
func (o *FullAPIKeyAttributes) SetDateLastUsedNil() {
140+
o.DateLastUsed.Set(nil)
141+
}
142+
143+
// UnsetDateLastUsed ensures that no value is present for DateLastUsed, not even an explicit nil.
144+
func (o *FullAPIKeyAttributes) UnsetDateLastUsed() {
145+
o.DateLastUsed.Unset()
146+
}
147+
107148
// GetKey returns the Key field value if set, zero value otherwise.
108149
func (o *FullAPIKeyAttributes) GetKey() string {
109150
if o == nil || o.Key == nil {
@@ -260,6 +301,9 @@ func (o FullAPIKeyAttributes) MarshalJSON() ([]byte, error) {
260301
toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00")
261302
}
262303
}
304+
if o.DateLastUsed.IsSet() {
305+
toSerialize["date_last_used"] = o.DateLastUsed.Get()
306+
}
263307
if o.Key != nil {
264308
toSerialize["key"] = o.Key
265309
}
@@ -289,25 +333,27 @@ func (o FullAPIKeyAttributes) MarshalJSON() ([]byte, error) {
289333
// UnmarshalJSON deserializes the given payload.
290334
func (o *FullAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) {
291335
all := struct {
292-
Category *string `json:"category,omitempty"`
293-
CreatedAt *time.Time `json:"created_at,omitempty"`
294-
Key *string `json:"key,omitempty"`
295-
Last4 *string `json:"last4,omitempty"`
296-
ModifiedAt *time.Time `json:"modified_at,omitempty"`
297-
Name *string `json:"name,omitempty"`
298-
RemoteConfigReadEnabled *bool `json:"remote_config_read_enabled,omitempty"`
336+
Category *string `json:"category,omitempty"`
337+
CreatedAt *time.Time `json:"created_at,omitempty"`
338+
DateLastUsed datadog.NullableTime `json:"date_last_used,omitempty"`
339+
Key *string `json:"key,omitempty"`
340+
Last4 *string `json:"last4,omitempty"`
341+
ModifiedAt *time.Time `json:"modified_at,omitempty"`
342+
Name *string `json:"name,omitempty"`
343+
RemoteConfigReadEnabled *bool `json:"remote_config_read_enabled,omitempty"`
299344
}{}
300345
if err = datadog.Unmarshal(bytes, &all); err != nil {
301346
return datadog.Unmarshal(bytes, &o.UnparsedObject)
302347
}
303348
additionalProperties := make(map[string]interface{})
304349
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
305-
datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "key", "last4", "modified_at", "name", "remote_config_read_enabled"})
350+
datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "date_last_used", "key", "last4", "modified_at", "name", "remote_config_read_enabled"})
306351
} else {
307352
return err
308353
}
309354
o.Category = all.Category
310355
o.CreatedAt = all.CreatedAt
356+
o.DateLastUsed = all.DateLastUsed
311357
o.Key = all.Key
312358
o.Last4 = all.Last4
313359
o.ModifiedAt = all.ModifiedAt

api/datadogV2/model_full_application_key_attributes.go

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ type FullApplicationKeyAttributes struct {
1818
Key *string `json:"key,omitempty"`
1919
// The last four characters of the application key.
2020
Last4 *string `json:"last4,omitempty"`
21+
// Last usage timestamp of the application key.
22+
LastUsedAt datadog.NullableTime `json:"last_used_at,omitempty"`
2123
// Name of the application key.
2224
Name *string `json:"name,omitempty"`
2325
// Array of scopes to grant the application key.
@@ -128,6 +130,45 @@ func (o *FullApplicationKeyAttributes) SetLast4(v string) {
128130
o.Last4 = &v
129131
}
130132

133+
// GetLastUsedAt returns the LastUsedAt field value if set, zero value otherwise (both if not set or set to explicit null).
134+
func (o *FullApplicationKeyAttributes) GetLastUsedAt() time.Time {
135+
if o == nil || o.LastUsedAt.Get() == nil {
136+
var ret time.Time
137+
return ret
138+
}
139+
return *o.LastUsedAt.Get()
140+
}
141+
142+
// GetLastUsedAtOk returns a tuple with the LastUsedAt field value if set, nil otherwise
143+
// and a boolean to check if the value has been set.
144+
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
145+
func (o *FullApplicationKeyAttributes) GetLastUsedAtOk() (*time.Time, bool) {
146+
if o == nil {
147+
return nil, false
148+
}
149+
return o.LastUsedAt.Get(), o.LastUsedAt.IsSet()
150+
}
151+
152+
// HasLastUsedAt returns a boolean if a field has been set.
153+
func (o *FullApplicationKeyAttributes) HasLastUsedAt() bool {
154+
return o != nil && o.LastUsedAt.IsSet()
155+
}
156+
157+
// SetLastUsedAt gets a reference to the given datadog.NullableTime and assigns it to the LastUsedAt field.
158+
func (o *FullApplicationKeyAttributes) SetLastUsedAt(v time.Time) {
159+
o.LastUsedAt.Set(&v)
160+
}
161+
162+
// SetLastUsedAtNil sets the value for LastUsedAt to be an explicit nil.
163+
func (o *FullApplicationKeyAttributes) SetLastUsedAtNil() {
164+
o.LastUsedAt.Set(nil)
165+
}
166+
167+
// UnsetLastUsedAt ensures that no value is present for LastUsedAt, not even an explicit nil.
168+
func (o *FullApplicationKeyAttributes) UnsetLastUsedAt() {
169+
o.LastUsedAt.Unset()
170+
}
171+
131172
// GetName returns the Name field value if set, zero value otherwise.
132173
func (o *FullApplicationKeyAttributes) GetName() string {
133174
if o == nil || o.Name == nil {
@@ -214,6 +255,9 @@ func (o FullApplicationKeyAttributes) MarshalJSON() ([]byte, error) {
214255
if o.Last4 != nil {
215256
toSerialize["last4"] = o.Last4
216257
}
258+
if o.LastUsedAt.IsSet() {
259+
toSerialize["last_used_at"] = o.LastUsedAt.Get()
260+
}
217261
if o.Name != nil {
218262
toSerialize["name"] = o.Name
219263
}
@@ -230,24 +274,26 @@ func (o FullApplicationKeyAttributes) MarshalJSON() ([]byte, error) {
230274
// UnmarshalJSON deserializes the given payload.
231275
func (o *FullApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) {
232276
all := struct {
233-
CreatedAt *time.Time `json:"created_at,omitempty"`
234-
Key *string `json:"key,omitempty"`
235-
Last4 *string `json:"last4,omitempty"`
236-
Name *string `json:"name,omitempty"`
237-
Scopes datadog.NullableList[string] `json:"scopes,omitempty"`
277+
CreatedAt *time.Time `json:"created_at,omitempty"`
278+
Key *string `json:"key,omitempty"`
279+
Last4 *string `json:"last4,omitempty"`
280+
LastUsedAt datadog.NullableTime `json:"last_used_at,omitempty"`
281+
Name *string `json:"name,omitempty"`
282+
Scopes datadog.NullableList[string] `json:"scopes,omitempty"`
238283
}{}
239284
if err = datadog.Unmarshal(bytes, &all); err != nil {
240285
return datadog.Unmarshal(bytes, &o.UnparsedObject)
241286
}
242287
additionalProperties := make(map[string]interface{})
243288
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
244-
datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "key", "last4", "name", "scopes"})
289+
datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "key", "last4", "last_used_at", "name", "scopes"})
245290
} else {
246291
return err
247292
}
248293
o.CreatedAt = all.CreatedAt
249294
o.Key = all.Key
250295
o.Last4 = all.Last4
296+
o.LastUsedAt = all.LastUsedAt
251297
o.Name = all.Name
252298
o.Scopes = all.Scopes
253299

api/datadogV2/model_partial_api_key_attributes.go

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
package datadogV2
66

77
import (
8+
"time"
9+
810
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
911
)
1012

@@ -14,6 +16,8 @@ type PartialAPIKeyAttributes struct {
1416
Category *string `json:"category,omitempty"`
1517
// Creation date of the API key.
1618
CreatedAt *string `json:"created_at,omitempty"`
19+
// Date the API Key was last used.
20+
DateLastUsed datadog.NullableTime `json:"date_last_used,omitempty"`
1721
// The last four characters of the API key.
1822
Last4 *string `json:"last4,omitempty"`
1923
// Date the API key was last modified.
@@ -100,6 +104,45 @@ func (o *PartialAPIKeyAttributes) SetCreatedAt(v string) {
100104
o.CreatedAt = &v
101105
}
102106

107+
// GetDateLastUsed returns the DateLastUsed field value if set, zero value otherwise (both if not set or set to explicit null).
108+
func (o *PartialAPIKeyAttributes) GetDateLastUsed() time.Time {
109+
if o == nil || o.DateLastUsed.Get() == nil {
110+
var ret time.Time
111+
return ret
112+
}
113+
return *o.DateLastUsed.Get()
114+
}
115+
116+
// GetDateLastUsedOk returns a tuple with the DateLastUsed field value if set, nil otherwise
117+
// and a boolean to check if the value has been set.
118+
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
119+
func (o *PartialAPIKeyAttributes) GetDateLastUsedOk() (*time.Time, bool) {
120+
if o == nil {
121+
return nil, false
122+
}
123+
return o.DateLastUsed.Get(), o.DateLastUsed.IsSet()
124+
}
125+
126+
// HasDateLastUsed returns a boolean if a field has been set.
127+
func (o *PartialAPIKeyAttributes) HasDateLastUsed() bool {
128+
return o != nil && o.DateLastUsed.IsSet()
129+
}
130+
131+
// SetDateLastUsed gets a reference to the given datadog.NullableTime and assigns it to the DateLastUsed field.
132+
func (o *PartialAPIKeyAttributes) SetDateLastUsed(v time.Time) {
133+
o.DateLastUsed.Set(&v)
134+
}
135+
136+
// SetDateLastUsedNil sets the value for DateLastUsed to be an explicit nil.
137+
func (o *PartialAPIKeyAttributes) SetDateLastUsedNil() {
138+
o.DateLastUsed.Set(nil)
139+
}
140+
141+
// UnsetDateLastUsed ensures that no value is present for DateLastUsed, not even an explicit nil.
142+
func (o *PartialAPIKeyAttributes) UnsetDateLastUsed() {
143+
o.DateLastUsed.Unset()
144+
}
145+
103146
// GetLast4 returns the Last4 field value if set, zero value otherwise.
104147
func (o *PartialAPIKeyAttributes) GetLast4() string {
105148
if o == nil || o.Last4 == nil {
@@ -224,6 +267,9 @@ func (o PartialAPIKeyAttributes) MarshalJSON() ([]byte, error) {
224267
if o.CreatedAt != nil {
225268
toSerialize["created_at"] = o.CreatedAt
226269
}
270+
if o.DateLastUsed.IsSet() {
271+
toSerialize["date_last_used"] = o.DateLastUsed.Get()
272+
}
227273
if o.Last4 != nil {
228274
toSerialize["last4"] = o.Last4
229275
}
@@ -246,24 +292,26 @@ func (o PartialAPIKeyAttributes) MarshalJSON() ([]byte, error) {
246292
// UnmarshalJSON deserializes the given payload.
247293
func (o *PartialAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) {
248294
all := struct {
249-
Category *string `json:"category,omitempty"`
250-
CreatedAt *string `json:"created_at,omitempty"`
251-
Last4 *string `json:"last4,omitempty"`
252-
ModifiedAt *string `json:"modified_at,omitempty"`
253-
Name *string `json:"name,omitempty"`
254-
RemoteConfigReadEnabled *bool `json:"remote_config_read_enabled,omitempty"`
295+
Category *string `json:"category,omitempty"`
296+
CreatedAt *string `json:"created_at,omitempty"`
297+
DateLastUsed datadog.NullableTime `json:"date_last_used,omitempty"`
298+
Last4 *string `json:"last4,omitempty"`
299+
ModifiedAt *string `json:"modified_at,omitempty"`
300+
Name *string `json:"name,omitempty"`
301+
RemoteConfigReadEnabled *bool `json:"remote_config_read_enabled,omitempty"`
255302
}{}
256303
if err = datadog.Unmarshal(bytes, &all); err != nil {
257304
return datadog.Unmarshal(bytes, &o.UnparsedObject)
258305
}
259306
additionalProperties := make(map[string]interface{})
260307
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
261-
datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "last4", "modified_at", "name", "remote_config_read_enabled"})
308+
datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "date_last_used", "last4", "modified_at", "name", "remote_config_read_enabled"})
262309
} else {
263310
return err
264311
}
265312
o.Category = all.Category
266313
o.CreatedAt = all.CreatedAt
314+
o.DateLastUsed = all.DateLastUsed
267315
o.Last4 = all.Last4
268316
o.ModifiedAt = all.ModifiedAt
269317
o.Name = all.Name

0 commit comments

Comments
 (0)