From ca53a340e3bcb8b284d2989dd8c4903ac3ca8655 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 13:55:58 +0000 Subject: [PATCH] add mfa_enabled field and change created_at type to datetime (#2615) Co-authored-by: ci.datadog-api-spec Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> --- .apigentools-info | 8 ++-- .generator/schemas/v2/openapi.yaml | 5 +++ .../model_full_application_key_attributes.go | 22 +++++++---- api/datadogV2/model_user_attributes.go | 37 ++++++++++++++++++- 4 files changed, 59 insertions(+), 13 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index f6b051be80c..4951056b1f0 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-08-09 16:10:45.310669", - "spec_repo_commit": "4a0f9e08" + "regenerated": "2024-08-12 13:34:54.556770", + "spec_repo_commit": "0360f6c8" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-08-09 16:10:45.328777", - "spec_repo_commit": "4a0f9e08" + "regenerated": "2024-08-12 13:34:54.576362", + "spec_repo_commit": "0360f6c8" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 33e50da3602..d0dfeea6d54 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -8496,6 +8496,7 @@ components: created_at: description: Creation date of the application key. example: '2020-11-23T10:00:00.000Z' + format: date-time readOnly: true type: string key: @@ -23415,6 +23416,10 @@ components: icon: description: URL of the user's icon. type: string + mfa_enabled: + description: If user has MFA enabled. + readOnly: true + type: boolean modified_at: description: Time that the user was last modified. format: date-time diff --git a/api/datadogV2/model_full_application_key_attributes.go b/api/datadogV2/model_full_application_key_attributes.go index d44038ed794..b523c4a99a0 100644 --- a/api/datadogV2/model_full_application_key_attributes.go +++ b/api/datadogV2/model_full_application_key_attributes.go @@ -5,13 +5,15 @@ package datadogV2 import ( + "time" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // FullApplicationKeyAttributes Attributes of a full application key. type FullApplicationKeyAttributes struct { // Creation date of the application key. - CreatedAt *string `json:"created_at,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` // The application key. Key *string `json:"key,omitempty"` // The last four characters of the application key. @@ -43,9 +45,9 @@ func NewFullApplicationKeyAttributesWithDefaults() *FullApplicationKeyAttributes } // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *FullApplicationKeyAttributes) GetCreatedAt() string { +func (o *FullApplicationKeyAttributes) GetCreatedAt() time.Time { if o == nil || o.CreatedAt == nil { - var ret string + var ret time.Time return ret } return *o.CreatedAt @@ -53,7 +55,7 @@ func (o *FullApplicationKeyAttributes) GetCreatedAt() string { // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *FullApplicationKeyAttributes) GetCreatedAtOk() (*string, bool) { +func (o *FullApplicationKeyAttributes) GetCreatedAtOk() (*time.Time, bool) { if o == nil || o.CreatedAt == nil { return nil, false } @@ -65,8 +67,8 @@ func (o *FullApplicationKeyAttributes) HasCreatedAt() bool { return o != nil && o.CreatedAt != nil } -// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. -func (o *FullApplicationKeyAttributes) SetCreatedAt(v string) { +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *FullApplicationKeyAttributes) SetCreatedAt(v time.Time) { o.CreatedAt = &v } @@ -200,7 +202,11 @@ func (o FullApplicationKeyAttributes) MarshalJSON() ([]byte, error) { return datadog.Marshal(o.UnparsedObject) } if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } } if o.Key != nil { toSerialize["key"] = o.Key @@ -224,7 +230,7 @@ func (o FullApplicationKeyAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FullApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - CreatedAt *string `json:"created_at,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` Key *string `json:"key,omitempty"` Last4 *string `json:"last4,omitempty"` Name *string `json:"name,omitempty"` diff --git a/api/datadogV2/model_user_attributes.go b/api/datadogV2/model_user_attributes.go index a6811d26f31..3f0238260e8 100644 --- a/api/datadogV2/model_user_attributes.go +++ b/api/datadogV2/model_user_attributes.go @@ -22,6 +22,8 @@ type UserAttributes struct { Handle *string `json:"handle,omitempty"` // URL of the user's icon. Icon *string `json:"icon,omitempty"` + // If user has MFA enabled. + MfaEnabled *bool `json:"mfa_enabled,omitempty"` // Time that the user was last modified. ModifiedAt *time.Time `json:"modified_at,omitempty"` // Name of the user. @@ -196,6 +198,34 @@ func (o *UserAttributes) SetIcon(v string) { o.Icon = &v } +// GetMfaEnabled returns the MfaEnabled field value if set, zero value otherwise. +func (o *UserAttributes) GetMfaEnabled() bool { + if o == nil || o.MfaEnabled == nil { + var ret bool + return ret + } + return *o.MfaEnabled +} + +// GetMfaEnabledOk returns a tuple with the MfaEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserAttributes) GetMfaEnabledOk() (*bool, bool) { + if o == nil || o.MfaEnabled == nil { + return nil, false + } + return o.MfaEnabled, true +} + +// HasMfaEnabled returns a boolean if a field has been set. +func (o *UserAttributes) HasMfaEnabled() bool { + return o != nil && o.MfaEnabled != nil +} + +// SetMfaEnabled gets a reference to the given bool and assigns it to the MfaEnabled field. +func (o *UserAttributes) SetMfaEnabled(v bool) { + o.MfaEnabled = &v +} + // GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. func (o *UserAttributes) GetModifiedAt() time.Time { if o == nil || o.ModifiedAt == nil { @@ -411,6 +441,9 @@ func (o UserAttributes) MarshalJSON() ([]byte, error) { if o.Icon != nil { toSerialize["icon"] = o.Icon } + if o.MfaEnabled != nil { + toSerialize["mfa_enabled"] = o.MfaEnabled + } if o.ModifiedAt != nil { if o.ModifiedAt.Nanosecond() == 0 { toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") @@ -448,6 +481,7 @@ func (o *UserAttributes) UnmarshalJSON(bytes []byte) (err error) { Email *string `json:"email,omitempty"` Handle *string `json:"handle,omitempty"` Icon *string `json:"icon,omitempty"` + MfaEnabled *bool `json:"mfa_enabled,omitempty"` ModifiedAt *time.Time `json:"modified_at,omitempty"` Name datadog.NullableString `json:"name,omitempty"` ServiceAccount *bool `json:"service_account,omitempty"` @@ -460,7 +494,7 @@ func (o *UserAttributes) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "disabled", "email", "handle", "icon", "modified_at", "name", "service_account", "status", "title", "verified"}) + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "disabled", "email", "handle", "icon", "mfa_enabled", "modified_at", "name", "service_account", "status", "title", "verified"}) } else { return err } @@ -469,6 +503,7 @@ func (o *UserAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Email = all.Email o.Handle = all.Handle o.Icon = all.Icon + o.MfaEnabled = all.MfaEnabled o.ModifiedAt = all.ModifiedAt o.Name = all.Name o.ServiceAccount = all.ServiceAccount