From b5761e40081503641916ab76fc6b98a02cc2c96c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 23 Sep 2024 15:01:50 +0000 Subject: [PATCH] Regenerate client from commit d6c0e0af of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 120 ++++++++ api/datadogV2/model_user_create_attributes.go | 227 +++++++++++++- .../model_user_invitation_data_attributes.go | 56 +++- api/datadogV2/model_user_orgs_serializable.go | 186 ++++++++++++ ...model_user_orgs_serializable_attributes.go | 277 ++++++++++++++++++ .../model_user_orgs_serializable_type.go | 64 ++++ .../model_user_override_identity_provider.go | 186 ++++++++++++ ...r_override_identity_provider_attributes.go | 102 +++++++ ...el_user_override_identity_provider_type.go | 64 ++++ .../model_user_response_included_item.go | 70 ++++- api/datadogV2/model_user_update_attributes.go | 239 ++++++++++++++- tests/scenarios/features/v2/users.feature | 4 +- 13 files changed, 1581 insertions(+), 22 deletions(-) create mode 100644 api/datadogV2/model_user_orgs_serializable.go create mode 100644 api/datadogV2/model_user_orgs_serializable_attributes.go create mode 100644 api/datadogV2/model_user_orgs_serializable_type.go create mode 100644 api/datadogV2/model_user_override_identity_provider.go create mode 100644 api/datadogV2/model_user_override_identity_provider_attributes.go create mode 100644 api/datadogV2/model_user_override_identity_provider_type.go diff --git a/.apigentools-info b/.apigentools-info index d7f93b66e48..fde17330aab 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-23 05:08:46.711337", - "spec_repo_commit": "253b7b76" + "regenerated": "2024-09-23 15:00:12.730464", + "spec_repo_commit": "d6c0e0af" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-23 05:08:46.726569", - "spec_repo_commit": "253b7b76" + "regenerated": "2024-09-23 15:00:12.745245", + "spec_repo_commit": "d6c0e0af" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3dac639ac73..c85595211ae 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -24635,16 +24635,36 @@ components: UserCreateAttributes: description: Attributes of the created user. properties: + created_at: + description: The `UserCreateAttributes` `created_at`. + format: date-time + type: string + disabled: + description: The `UserCreateAttributes` `disabled`. + type: boolean email: description: The email of the user. example: jane.doe@example.com type: string + handle: + description: The `UserCreateAttributes` `handle`. + type: string + modified_at: + description: The `UserCreateAttributes` `modified_at`. + format: date-time + type: string name: description: The name of the user. type: string + service_account: + description: The `UserCreateAttributes` `service_account`. + type: boolean title: description: The title of the user. type: string + verified: + description: The `UserCreateAttributes` `verified`. + type: boolean required: - email type: object @@ -24694,6 +24714,10 @@ components: invite_type: description: Type of invitation. type: string + login_method: + description: The `UserInvitationDataAttributes` `login_method`. + nullable: true + type: string uuid: description: UUID of the user invitation. type: string @@ -24755,6 +24779,79 @@ components: type: string x-enum-varnames: - USER_INVITATIONS + UserOrgsSerializable: + description: The definition of `UserOrgsSerializable` object. + properties: + attributes: + $ref: '#/components/schemas/UserOrgsSerializableAttributes' + id: + description: The `UserOrgsSerializable` `id`. + type: string + type: + $ref: '#/components/schemas/UserOrgsSerializableType' + required: + - type + type: object + UserOrgsSerializableAttributes: + description: The definition of `UserOrgsSerializableAttributes` object. + properties: + disabled: + description: The `UserOrgsSerializableAttributes` `disabled`. + type: boolean + email: + description: The `UserOrgsSerializableAttributes` `email`. + type: string + name: + description: The `UserOrgsSerializableAttributes` `name`. + type: string + org_id: + description: The `UserOrgsSerializableAttributes` `org_id`. + type: string + title: + description: The `UserOrgsSerializableAttributes` `title`. + type: string + verified: + description: The `UserOrgsSerializableAttributes` `verified`. + type: boolean + type: object + UserOrgsSerializableType: + default: users + description: The definition of `UserOrgsSerializableType` object. + enum: + - users + example: users + type: string + x-enum-varnames: + - USERS + UserOverrideIdentityProvider: + description: The definition of `UserOverrideIdentityProvider` object. + properties: + attributes: + $ref: '#/components/schemas/UserOverrideIdentityProviderAttributes' + id: + description: The `UserOverrideIdentityProvider` `id`. + type: string + type: + $ref: '#/components/schemas/UserOverrideIdentityProviderType' + required: + - type + type: object + UserOverrideIdentityProviderAttributes: + description: The definition of `UserOverrideIdentityProviderAttributes` object. + properties: + authentication_method: + description: The `UserOverrideIdentityProviderAttributes` `authentication_method`. + type: string + type: object + UserOverrideIdentityProviderType: + default: identity_providers + description: The definition of `UserOverrideIdentityProviderType` object. + enum: + - identity_providers + example: identity_providers + type: string + x-enum-varnames: + - IDENTITY_PROVIDERS UserRelationshipData: description: Relationship to user object. properties: @@ -24800,6 +24897,8 @@ components: - $ref: '#/components/schemas/Organization' - $ref: '#/components/schemas/Permission' - $ref: '#/components/schemas/Role' + - $ref: '#/components/schemas/UserOverrideIdentityProvider' + - $ref: '#/components/schemas/UserOrgsSerializable' UserResponseRelationships: description: Relationships of the user object returned by the API. properties: @@ -25038,15 +25137,36 @@ components: UserUpdateAttributes: description: Attributes of the edited user. properties: + created_at: + description: The `UserUpdateAttributes` `created_at`. + format: date-time + type: string disabled: description: If the user is enabled or disabled. type: boolean email: description: The email of the user. type: string + handle: + description: The `UserUpdateAttributes` `handle`. + type: string + modified_at: + description: The `UserUpdateAttributes` `modified_at`. + format: date-time + type: string name: description: The name of the user. type: string + service_account: + description: The `UserUpdateAttributes` `service_account`. + type: boolean + title: + description: The `UserUpdateAttributes` `title`. + nullable: true + type: string + verified: + description: The `UserUpdateAttributes` `verified`. + type: boolean type: object UserUpdateData: description: Object to update a user. diff --git a/api/datadogV2/model_user_create_attributes.go b/api/datadogV2/model_user_create_attributes.go index 605ddc7d92c..305d0e2da8b 100644 --- a/api/datadogV2/model_user_create_attributes.go +++ b/api/datadogV2/model_user_create_attributes.go @@ -6,18 +6,31 @@ package datadogV2 import ( "fmt" + "time" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // UserCreateAttributes Attributes of the created user. type UserCreateAttributes struct { + // The `UserCreateAttributes` `created_at`. + CreatedAt *time.Time `json:"created_at,omitempty"` + // The `UserCreateAttributes` `disabled`. + Disabled *bool `json:"disabled,omitempty"` // The email of the user. Email string `json:"email"` + // The `UserCreateAttributes` `handle`. + Handle *string `json:"handle,omitempty"` + // The `UserCreateAttributes` `modified_at`. + ModifiedAt *time.Time `json:"modified_at,omitempty"` // The name of the user. Name *string `json:"name,omitempty"` + // The `UserCreateAttributes` `service_account`. + ServiceAccount *bool `json:"service_account,omitempty"` // The title of the user. Title *string `json:"title,omitempty"` + // The `UserCreateAttributes` `verified`. + Verified *bool `json:"verified,omitempty"` // 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:"-"` @@ -41,6 +54,62 @@ func NewUserCreateAttributesWithDefaults() *UserCreateAttributes { return &this } +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UserCreateAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// 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 *UserCreateAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UserCreateAttributes) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UserCreateAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *UserCreateAttributes) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateAttributes) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *UserCreateAttributes) HasDisabled() bool { + return o != nil && o.Disabled != nil +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *UserCreateAttributes) SetDisabled(v bool) { + o.Disabled = &v +} + // GetEmail returns the Email field value. func (o *UserCreateAttributes) GetEmail() string { if o == nil { @@ -64,6 +133,62 @@ func (o *UserCreateAttributes) SetEmail(v string) { o.Email = v } +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *UserCreateAttributes) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateAttributes) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *UserCreateAttributes) HasHandle() bool { + return o != nil && o.Handle != nil +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *UserCreateAttributes) SetHandle(v string) { + o.Handle = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *UserCreateAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *UserCreateAttributes) HasModifiedAt() bool { + return o != nil && o.ModifiedAt != nil +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *UserCreateAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + // GetName returns the Name field value if set, zero value otherwise. func (o *UserCreateAttributes) GetName() string { if o == nil || o.Name == nil { @@ -92,6 +217,34 @@ func (o *UserCreateAttributes) SetName(v string) { o.Name = &v } +// GetServiceAccount returns the ServiceAccount field value if set, zero value otherwise. +func (o *UserCreateAttributes) GetServiceAccount() bool { + if o == nil || o.ServiceAccount == nil { + var ret bool + return ret + } + return *o.ServiceAccount +} + +// GetServiceAccountOk returns a tuple with the ServiceAccount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateAttributes) GetServiceAccountOk() (*bool, bool) { + if o == nil || o.ServiceAccount == nil { + return nil, false + } + return o.ServiceAccount, true +} + +// HasServiceAccount returns a boolean if a field has been set. +func (o *UserCreateAttributes) HasServiceAccount() bool { + return o != nil && o.ServiceAccount != nil +} + +// SetServiceAccount gets a reference to the given bool and assigns it to the ServiceAccount field. +func (o *UserCreateAttributes) SetServiceAccount(v bool) { + o.ServiceAccount = &v +} + // GetTitle returns the Title field value if set, zero value otherwise. func (o *UserCreateAttributes) GetTitle() string { if o == nil || o.Title == nil { @@ -120,19 +273,73 @@ func (o *UserCreateAttributes) SetTitle(v string) { o.Title = &v } +// GetVerified returns the Verified field value if set, zero value otherwise. +func (o *UserCreateAttributes) GetVerified() bool { + if o == nil || o.Verified == nil { + var ret bool + return ret + } + return *o.Verified +} + +// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserCreateAttributes) GetVerifiedOk() (*bool, bool) { + if o == nil || o.Verified == nil { + return nil, false + } + return o.Verified, true +} + +// HasVerified returns a boolean if a field has been set. +func (o *UserCreateAttributes) HasVerified() bool { + return o != nil && o.Verified != nil +} + +// SetVerified gets a reference to the given bool and assigns it to the Verified field. +func (o *UserCreateAttributes) SetVerified(v bool) { + o.Verified = &v +} + // MarshalJSON serializes the struct using spec logic. func (o UserCreateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } + if o.CreatedAt != nil { + 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.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } toSerialize["email"] = o.Email + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } if o.Name != nil { toSerialize["name"] = o.Name } + if o.ServiceAccount != nil { + toSerialize["service_account"] = o.ServiceAccount + } if o.Title != nil { toSerialize["title"] = o.Title } + if o.Verified != nil { + toSerialize["verified"] = o.Verified + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -143,9 +350,15 @@ func (o UserCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Email *string `json:"email"` - Name *string `json:"name,omitempty"` - Title *string `json:"title,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email"` + Handle *string `json:"handle,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name *string `json:"name,omitempty"` + ServiceAccount *bool `json:"service_account,omitempty"` + Title *string `json:"title,omitempty"` + Verified *bool `json:"verified,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -155,13 +368,19 @@ func (o *UserCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"email", "name", "title"}) + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "disabled", "email", "handle", "modified_at", "name", "service_account", "title", "verified"}) } else { return err } + o.CreatedAt = all.CreatedAt + o.Disabled = all.Disabled o.Email = *all.Email + o.Handle = all.Handle + o.ModifiedAt = all.ModifiedAt o.Name = all.Name + o.ServiceAccount = all.ServiceAccount o.Title = all.Title + o.Verified = all.Verified if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_user_invitation_data_attributes.go b/api/datadogV2/model_user_invitation_data_attributes.go index 74e56493dad..7d769ae6e18 100644 --- a/api/datadogV2/model_user_invitation_data_attributes.go +++ b/api/datadogV2/model_user_invitation_data_attributes.go @@ -18,6 +18,8 @@ type UserInvitationDataAttributes struct { ExpiresAt *time.Time `json:"expires_at,omitempty"` // Type of invitation. InviteType *string `json:"invite_type,omitempty"` + // The `UserInvitationDataAttributes` `login_method`. + LoginMethod datadog.NullableString `json:"login_method,omitempty"` // UUID of the user invitation. Uuid *string `json:"uuid,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -126,6 +128,45 @@ func (o *UserInvitationDataAttributes) SetInviteType(v string) { o.InviteType = &v } +// GetLoginMethod returns the LoginMethod field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UserInvitationDataAttributes) GetLoginMethod() string { + if o == nil || o.LoginMethod.Get() == nil { + var ret string + return ret + } + return *o.LoginMethod.Get() +} + +// GetLoginMethodOk returns a tuple with the LoginMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *UserInvitationDataAttributes) GetLoginMethodOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LoginMethod.Get(), o.LoginMethod.IsSet() +} + +// HasLoginMethod returns a boolean if a field has been set. +func (o *UserInvitationDataAttributes) HasLoginMethod() bool { + return o != nil && o.LoginMethod.IsSet() +} + +// SetLoginMethod gets a reference to the given datadog.NullableString and assigns it to the LoginMethod field. +func (o *UserInvitationDataAttributes) SetLoginMethod(v string) { + o.LoginMethod.Set(&v) +} + +// SetLoginMethodNil sets the value for LoginMethod to be an explicit nil. +func (o *UserInvitationDataAttributes) SetLoginMethodNil() { + o.LoginMethod.Set(nil) +} + +// UnsetLoginMethod ensures that no value is present for LoginMethod, not even an explicit nil. +func (o *UserInvitationDataAttributes) UnsetLoginMethod() { + o.LoginMethod.Unset() +} + // GetUuid returns the Uuid field value if set, zero value otherwise. func (o *UserInvitationDataAttributes) GetUuid() string { if o == nil || o.Uuid == nil { @@ -177,6 +218,9 @@ func (o UserInvitationDataAttributes) MarshalJSON() ([]byte, error) { if o.InviteType != nil { toSerialize["invite_type"] = o.InviteType } + if o.LoginMethod.IsSet() { + toSerialize["login_method"] = o.LoginMethod.Get() + } if o.Uuid != nil { toSerialize["uuid"] = o.Uuid } @@ -190,23 +234,25 @@ func (o UserInvitationDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationDataAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - CreatedAt *time.Time `json:"created_at,omitempty"` - ExpiresAt *time.Time `json:"expires_at,omitempty"` - InviteType *string `json:"invite_type,omitempty"` - Uuid *string `json:"uuid,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + ExpiresAt *time.Time `json:"expires_at,omitempty"` + InviteType *string `json:"invite_type,omitempty"` + LoginMethod datadog.NullableString `json:"login_method,omitempty"` + Uuid *string `json:"uuid,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "expires_at", "invite_type", "uuid"}) + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "expires_at", "invite_type", "login_method", "uuid"}) } else { return err } o.CreatedAt = all.CreatedAt o.ExpiresAt = all.ExpiresAt o.InviteType = all.InviteType + o.LoginMethod = all.LoginMethod o.Uuid = all.Uuid if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_user_orgs_serializable.go b/api/datadogV2/model_user_orgs_serializable.go new file mode 100644 index 00000000000..aac96604e41 --- /dev/null +++ b/api/datadogV2/model_user_orgs_serializable.go @@ -0,0 +1,186 @@ +// 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" +) + +// UserOrgsSerializable The definition of `UserOrgsSerializable` object. +type UserOrgsSerializable struct { + // The definition of `UserOrgsSerializableAttributes` object. + Attributes *UserOrgsSerializableAttributes `json:"attributes,omitempty"` + // The `UserOrgsSerializable` `id`. + Id *string `json:"id,omitempty"` + // The definition of `UserOrgsSerializableType` object. + Type UserOrgsSerializableType `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:"-"` +} + +// NewUserOrgsSerializable instantiates a new UserOrgsSerializable object. +// 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 NewUserOrgsSerializable(typeVar UserOrgsSerializableType) *UserOrgsSerializable { + this := UserOrgsSerializable{} + this.Type = typeVar + return &this +} + +// NewUserOrgsSerializableWithDefaults instantiates a new UserOrgsSerializable object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewUserOrgsSerializableWithDefaults() *UserOrgsSerializable { + this := UserOrgsSerializable{} + var typeVar UserOrgsSerializableType = USERORGSSERIALIZABLETYPE_USERS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UserOrgsSerializable) GetAttributes() UserOrgsSerializableAttributes { + if o == nil || o.Attributes == nil { + var ret UserOrgsSerializableAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOrgsSerializable) GetAttributesOk() (*UserOrgsSerializableAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *UserOrgsSerializable) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given UserOrgsSerializableAttributes and assigns it to the Attributes field. +func (o *UserOrgsSerializable) SetAttributes(v UserOrgsSerializableAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UserOrgsSerializable) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOrgsSerializable) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UserOrgsSerializable) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UserOrgsSerializable) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *UserOrgsSerializable) GetType() UserOrgsSerializableType { + if o == nil { + var ret UserOrgsSerializableType + 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 *UserOrgsSerializable) GetTypeOk() (*UserOrgsSerializableType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UserOrgsSerializable) SetType(v UserOrgsSerializableType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserOrgsSerializable) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserOrgsSerializable) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UserOrgsSerializableAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UserOrgsSerializableType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + 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", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_user_orgs_serializable_attributes.go b/api/datadogV2/model_user_orgs_serializable_attributes.go new file mode 100644 index 00000000000..f456876575c --- /dev/null +++ b/api/datadogV2/model_user_orgs_serializable_attributes.go @@ -0,0 +1,277 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UserOrgsSerializableAttributes The definition of `UserOrgsSerializableAttributes` object. +type UserOrgsSerializableAttributes struct { + // The `UserOrgsSerializableAttributes` `disabled`. + Disabled *bool `json:"disabled,omitempty"` + // The `UserOrgsSerializableAttributes` `email`. + Email *string `json:"email,omitempty"` + // The `UserOrgsSerializableAttributes` `name`. + Name *string `json:"name,omitempty"` + // The `UserOrgsSerializableAttributes` `org_id`. + OrgId *string `json:"org_id,omitempty"` + // The `UserOrgsSerializableAttributes` `title`. + Title *string `json:"title,omitempty"` + // The `UserOrgsSerializableAttributes` `verified`. + Verified *bool `json:"verified,omitempty"` + // 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:"-"` +} + +// NewUserOrgsSerializableAttributes instantiates a new UserOrgsSerializableAttributes object. +// 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 NewUserOrgsSerializableAttributes() *UserOrgsSerializableAttributes { + this := UserOrgsSerializableAttributes{} + return &this +} + +// NewUserOrgsSerializableAttributesWithDefaults instantiates a new UserOrgsSerializableAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewUserOrgsSerializableAttributesWithDefaults() *UserOrgsSerializableAttributes { + this := UserOrgsSerializableAttributes{} + return &this +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *UserOrgsSerializableAttributes) GetDisabled() bool { + if o == nil || o.Disabled == nil { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOrgsSerializableAttributes) GetDisabledOk() (*bool, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *UserOrgsSerializableAttributes) HasDisabled() bool { + return o != nil && o.Disabled != nil +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *UserOrgsSerializableAttributes) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *UserOrgsSerializableAttributes) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOrgsSerializableAttributes) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *UserOrgsSerializableAttributes) HasEmail() bool { + return o != nil && o.Email != nil +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *UserOrgsSerializableAttributes) SetEmail(v string) { + o.Email = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UserOrgsSerializableAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOrgsSerializableAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UserOrgsSerializableAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UserOrgsSerializableAttributes) SetName(v string) { + o.Name = &v +} + +// GetOrgId returns the OrgId field value if set, zero value otherwise. +func (o *UserOrgsSerializableAttributes) GetOrgId() string { + if o == nil || o.OrgId == nil { + var ret string + return ret + } + return *o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOrgsSerializableAttributes) GetOrgIdOk() (*string, bool) { + if o == nil || o.OrgId == nil { + return nil, false + } + return o.OrgId, true +} + +// HasOrgId returns a boolean if a field has been set. +func (o *UserOrgsSerializableAttributes) HasOrgId() bool { + return o != nil && o.OrgId != nil +} + +// SetOrgId gets a reference to the given string and assigns it to the OrgId field. +func (o *UserOrgsSerializableAttributes) SetOrgId(v string) { + o.OrgId = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *UserOrgsSerializableAttributes) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOrgsSerializableAttributes) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *UserOrgsSerializableAttributes) HasTitle() bool { + return o != nil && o.Title != nil +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *UserOrgsSerializableAttributes) SetTitle(v string) { + o.Title = &v +} + +// GetVerified returns the Verified field value if set, zero value otherwise. +func (o *UserOrgsSerializableAttributes) GetVerified() bool { + if o == nil || o.Verified == nil { + var ret bool + return ret + } + return *o.Verified +} + +// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOrgsSerializableAttributes) GetVerifiedOk() (*bool, bool) { + if o == nil || o.Verified == nil { + return nil, false + } + return o.Verified, true +} + +// HasVerified returns a boolean if a field has been set. +func (o *UserOrgsSerializableAttributes) HasVerified() bool { + return o != nil && o.Verified != nil +} + +// SetVerified gets a reference to the given bool and assigns it to the Verified field. +func (o *UserOrgsSerializableAttributes) SetVerified(v bool) { + o.Verified = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserOrgsSerializableAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.OrgId != nil { + toSerialize["org_id"] = o.OrgId + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.Verified != nil { + toSerialize["verified"] = o.Verified + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserOrgsSerializableAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + OrgId *string `json:"org_id,omitempty"` + Title *string `json:"title,omitempty"` + Verified *bool `json:"verified,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"disabled", "email", "name", "org_id", "title", "verified"}) + } else { + return err + } + o.Disabled = all.Disabled + o.Email = all.Email + o.Name = all.Name + o.OrgId = all.OrgId + o.Title = all.Title + o.Verified = all.Verified + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_user_orgs_serializable_type.go b/api/datadogV2/model_user_orgs_serializable_type.go new file mode 100644 index 00000000000..6a91c08d699 --- /dev/null +++ b/api/datadogV2/model_user_orgs_serializable_type.go @@ -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" +) + +// UserOrgsSerializableType The definition of `UserOrgsSerializableType` object. +type UserOrgsSerializableType string + +// List of UserOrgsSerializableType. +const ( + USERORGSSERIALIZABLETYPE_USERS UserOrgsSerializableType = "users" +) + +var allowedUserOrgsSerializableTypeEnumValues = []UserOrgsSerializableType{ + USERORGSSERIALIZABLETYPE_USERS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UserOrgsSerializableType) GetAllowedValues() []UserOrgsSerializableType { + return allowedUserOrgsSerializableTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UserOrgsSerializableType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UserOrgsSerializableType(value) + return nil +} + +// NewUserOrgsSerializableTypeFromValue returns a pointer to a valid UserOrgsSerializableType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUserOrgsSerializableTypeFromValue(v string) (*UserOrgsSerializableType, error) { + ev := UserOrgsSerializableType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UserOrgsSerializableType: valid values are %v", v, allowedUserOrgsSerializableTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UserOrgsSerializableType) IsValid() bool { + for _, existing := range allowedUserOrgsSerializableTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UserOrgsSerializableType value. +func (v UserOrgsSerializableType) Ptr() *UserOrgsSerializableType { + return &v +} diff --git a/api/datadogV2/model_user_override_identity_provider.go b/api/datadogV2/model_user_override_identity_provider.go new file mode 100644 index 00000000000..10ffb23da78 --- /dev/null +++ b/api/datadogV2/model_user_override_identity_provider.go @@ -0,0 +1,186 @@ +// 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" +) + +// UserOverrideIdentityProvider The definition of `UserOverrideIdentityProvider` object. +type UserOverrideIdentityProvider struct { + // The definition of `UserOverrideIdentityProviderAttributes` object. + Attributes *UserOverrideIdentityProviderAttributes `json:"attributes,omitempty"` + // The `UserOverrideIdentityProvider` `id`. + Id *string `json:"id,omitempty"` + // The definition of `UserOverrideIdentityProviderType` object. + Type UserOverrideIdentityProviderType `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:"-"` +} + +// NewUserOverrideIdentityProvider instantiates a new UserOverrideIdentityProvider object. +// 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 NewUserOverrideIdentityProvider(typeVar UserOverrideIdentityProviderType) *UserOverrideIdentityProvider { + this := UserOverrideIdentityProvider{} + this.Type = typeVar + return &this +} + +// NewUserOverrideIdentityProviderWithDefaults instantiates a new UserOverrideIdentityProvider object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewUserOverrideIdentityProviderWithDefaults() *UserOverrideIdentityProvider { + this := UserOverrideIdentityProvider{} + var typeVar UserOverrideIdentityProviderType = USEROVERRIDEIDENTITYPROVIDERTYPE_IDENTITY_PROVIDERS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UserOverrideIdentityProvider) GetAttributes() UserOverrideIdentityProviderAttributes { + if o == nil || o.Attributes == nil { + var ret UserOverrideIdentityProviderAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOverrideIdentityProvider) GetAttributesOk() (*UserOverrideIdentityProviderAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *UserOverrideIdentityProvider) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given UserOverrideIdentityProviderAttributes and assigns it to the Attributes field. +func (o *UserOverrideIdentityProvider) SetAttributes(v UserOverrideIdentityProviderAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UserOverrideIdentityProvider) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOverrideIdentityProvider) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UserOverrideIdentityProvider) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UserOverrideIdentityProvider) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *UserOverrideIdentityProvider) GetType() UserOverrideIdentityProviderType { + if o == nil { + var ret UserOverrideIdentityProviderType + 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 *UserOverrideIdentityProvider) GetTypeOk() (*UserOverrideIdentityProviderType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UserOverrideIdentityProvider) SetType(v UserOverrideIdentityProviderType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserOverrideIdentityProvider) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserOverrideIdentityProvider) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UserOverrideIdentityProviderAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UserOverrideIdentityProviderType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + 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", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_user_override_identity_provider_attributes.go b/api/datadogV2/model_user_override_identity_provider_attributes.go new file mode 100644 index 00000000000..105ff9c1fa2 --- /dev/null +++ b/api/datadogV2/model_user_override_identity_provider_attributes.go @@ -0,0 +1,102 @@ +// 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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UserOverrideIdentityProviderAttributes The definition of `UserOverrideIdentityProviderAttributes` object. +type UserOverrideIdentityProviderAttributes struct { + // The `UserOverrideIdentityProviderAttributes` `authentication_method`. + AuthenticationMethod *string `json:"authentication_method,omitempty"` + // 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:"-"` +} + +// NewUserOverrideIdentityProviderAttributes instantiates a new UserOverrideIdentityProviderAttributes object. +// 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 NewUserOverrideIdentityProviderAttributes() *UserOverrideIdentityProviderAttributes { + this := UserOverrideIdentityProviderAttributes{} + return &this +} + +// NewUserOverrideIdentityProviderAttributesWithDefaults instantiates a new UserOverrideIdentityProviderAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewUserOverrideIdentityProviderAttributesWithDefaults() *UserOverrideIdentityProviderAttributes { + this := UserOverrideIdentityProviderAttributes{} + return &this +} + +// GetAuthenticationMethod returns the AuthenticationMethod field value if set, zero value otherwise. +func (o *UserOverrideIdentityProviderAttributes) GetAuthenticationMethod() string { + if o == nil || o.AuthenticationMethod == nil { + var ret string + return ret + } + return *o.AuthenticationMethod +} + +// GetAuthenticationMethodOk returns a tuple with the AuthenticationMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserOverrideIdentityProviderAttributes) GetAuthenticationMethodOk() (*string, bool) { + if o == nil || o.AuthenticationMethod == nil { + return nil, false + } + return o.AuthenticationMethod, true +} + +// HasAuthenticationMethod returns a boolean if a field has been set. +func (o *UserOverrideIdentityProviderAttributes) HasAuthenticationMethod() bool { + return o != nil && o.AuthenticationMethod != nil +} + +// SetAuthenticationMethod gets a reference to the given string and assigns it to the AuthenticationMethod field. +func (o *UserOverrideIdentityProviderAttributes) SetAuthenticationMethod(v string) { + o.AuthenticationMethod = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserOverrideIdentityProviderAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AuthenticationMethod != nil { + toSerialize["authentication_method"] = o.AuthenticationMethod + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserOverrideIdentityProviderAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AuthenticationMethod *string `json:"authentication_method,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"authentication_method"}) + } else { + return err + } + o.AuthenticationMethod = all.AuthenticationMethod + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_user_override_identity_provider_type.go b/api/datadogV2/model_user_override_identity_provider_type.go new file mode 100644 index 00000000000..13b95b7c98b --- /dev/null +++ b/api/datadogV2/model_user_override_identity_provider_type.go @@ -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" +) + +// UserOverrideIdentityProviderType The definition of `UserOverrideIdentityProviderType` object. +type UserOverrideIdentityProviderType string + +// List of UserOverrideIdentityProviderType. +const ( + USEROVERRIDEIDENTITYPROVIDERTYPE_IDENTITY_PROVIDERS UserOverrideIdentityProviderType = "identity_providers" +) + +var allowedUserOverrideIdentityProviderTypeEnumValues = []UserOverrideIdentityProviderType{ + USEROVERRIDEIDENTITYPROVIDERTYPE_IDENTITY_PROVIDERS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UserOverrideIdentityProviderType) GetAllowedValues() []UserOverrideIdentityProviderType { + return allowedUserOverrideIdentityProviderTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UserOverrideIdentityProviderType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UserOverrideIdentityProviderType(value) + return nil +} + +// NewUserOverrideIdentityProviderTypeFromValue returns a pointer to a valid UserOverrideIdentityProviderType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUserOverrideIdentityProviderTypeFromValue(v string) (*UserOverrideIdentityProviderType, error) { + ev := UserOverrideIdentityProviderType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UserOverrideIdentityProviderType: valid values are %v", v, allowedUserOverrideIdentityProviderTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UserOverrideIdentityProviderType) IsValid() bool { + for _, existing := range allowedUserOverrideIdentityProviderTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UserOverrideIdentityProviderType value. +func (v UserOverrideIdentityProviderType) Ptr() *UserOverrideIdentityProviderType { + return &v +} diff --git a/api/datadogV2/model_user_response_included_item.go b/api/datadogV2/model_user_response_included_item.go index 5c31e1ca1d1..96ee3ccbb9a 100644 --- a/api/datadogV2/model_user_response_included_item.go +++ b/api/datadogV2/model_user_response_included_item.go @@ -10,9 +10,11 @@ import ( // UserResponseIncludedItem - An object related to a user. type UserResponseIncludedItem struct { - Organization *Organization - Permission *Permission - Role *Role + Organization *Organization + Permission *Permission + Role *Role + UserOverrideIdentityProvider *UserOverrideIdentityProvider + UserOrgsSerializable *UserOrgsSerializable // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject interface{} @@ -33,6 +35,16 @@ func RoleAsUserResponseIncludedItem(v *Role) UserResponseIncludedItem { return UserResponseIncludedItem{Role: v} } +// UserOverrideIdentityProviderAsUserResponseIncludedItem is a convenience function that returns UserOverrideIdentityProvider wrapped in UserResponseIncludedItem. +func UserOverrideIdentityProviderAsUserResponseIncludedItem(v *UserOverrideIdentityProvider) UserResponseIncludedItem { + return UserResponseIncludedItem{UserOverrideIdentityProvider: v} +} + +// UserOrgsSerializableAsUserResponseIncludedItem is a convenience function that returns UserOrgsSerializable wrapped in UserResponseIncludedItem. +func UserOrgsSerializableAsUserResponseIncludedItem(v *UserOrgsSerializable) UserResponseIncludedItem { + return UserResponseIncludedItem{UserOrgsSerializable: v} +} + // UnmarshalJSON turns data into one of the pointers in the struct. func (obj *UserResponseIncludedItem) UnmarshalJSON(data []byte) error { var err error @@ -88,11 +100,47 @@ func (obj *UserResponseIncludedItem) UnmarshalJSON(data []byte) error { obj.Role = nil } + // try to unmarshal data into UserOverrideIdentityProvider + err = datadog.Unmarshal(data, &obj.UserOverrideIdentityProvider) + if err == nil { + if obj.UserOverrideIdentityProvider != nil && obj.UserOverrideIdentityProvider.UnparsedObject == nil { + jsonUserOverrideIdentityProvider, _ := datadog.Marshal(obj.UserOverrideIdentityProvider) + if string(jsonUserOverrideIdentityProvider) == "{}" { // empty struct + obj.UserOverrideIdentityProvider = nil + } else { + match++ + } + } else { + obj.UserOverrideIdentityProvider = nil + } + } else { + obj.UserOverrideIdentityProvider = nil + } + + // try to unmarshal data into UserOrgsSerializable + err = datadog.Unmarshal(data, &obj.UserOrgsSerializable) + if err == nil { + if obj.UserOrgsSerializable != nil && obj.UserOrgsSerializable.UnparsedObject == nil { + jsonUserOrgsSerializable, _ := datadog.Marshal(obj.UserOrgsSerializable) + if string(jsonUserOrgsSerializable) == "{}" { // empty struct + obj.UserOrgsSerializable = nil + } else { + match++ + } + } else { + obj.UserOrgsSerializable = nil + } + } else { + obj.UserOrgsSerializable = nil + } + if match != 1 { // more than 1 match // reset to nil obj.Organization = nil obj.Permission = nil obj.Role = nil + obj.UserOverrideIdentityProvider = nil + obj.UserOrgsSerializable = nil return datadog.Unmarshal(data, &obj.UnparsedObject) } return nil // exactly one match @@ -112,6 +160,14 @@ func (obj UserResponseIncludedItem) MarshalJSON() ([]byte, error) { return datadog.Marshal(&obj.Role) } + if obj.UserOverrideIdentityProvider != nil { + return datadog.Marshal(&obj.UserOverrideIdentityProvider) + } + + if obj.UserOrgsSerializable != nil { + return datadog.Marshal(&obj.UserOrgsSerializable) + } + if obj.UnparsedObject != nil { return datadog.Marshal(obj.UnparsedObject) } @@ -132,6 +188,14 @@ func (obj *UserResponseIncludedItem) GetActualInstance() interface{} { return obj.Role } + if obj.UserOverrideIdentityProvider != nil { + return obj.UserOverrideIdentityProvider + } + + if obj.UserOrgsSerializable != nil { + return obj.UserOrgsSerializable + } + // all schemas are nil return nil } diff --git a/api/datadogV2/model_user_update_attributes.go b/api/datadogV2/model_user_update_attributes.go index 916b82a347d..642cfe1e941 100644 --- a/api/datadogV2/model_user_update_attributes.go +++ b/api/datadogV2/model_user_update_attributes.go @@ -5,17 +5,31 @@ package datadogV2 import ( + "time" + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // UserUpdateAttributes Attributes of the edited user. type UserUpdateAttributes struct { + // The `UserUpdateAttributes` `created_at`. + CreatedAt *time.Time `json:"created_at,omitempty"` // If the user is enabled or disabled. Disabled *bool `json:"disabled,omitempty"` // The email of the user. Email *string `json:"email,omitempty"` + // The `UserUpdateAttributes` `handle`. + Handle *string `json:"handle,omitempty"` + // The `UserUpdateAttributes` `modified_at`. + ModifiedAt *time.Time `json:"modified_at,omitempty"` // The name of the user. Name *string `json:"name,omitempty"` + // The `UserUpdateAttributes` `service_account`. + ServiceAccount *bool `json:"service_account,omitempty"` + // The `UserUpdateAttributes` `title`. + Title datadog.NullableString `json:"title,omitempty"` + // The `UserUpdateAttributes` `verified`. + Verified *bool `json:"verified,omitempty"` // 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:"-"` @@ -38,6 +52,34 @@ func NewUserUpdateAttributesWithDefaults() *UserUpdateAttributes { return &this } +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UserUpdateAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// 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 *UserUpdateAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UserUpdateAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + // GetDisabled returns the Disabled field value if set, zero value otherwise. func (o *UserUpdateAttributes) GetDisabled() bool { if o == nil || o.Disabled == nil { @@ -94,6 +136,62 @@ func (o *UserUpdateAttributes) SetEmail(v string) { o.Email = &v } +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *UserUpdateAttributes) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateAttributes) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasHandle() bool { + return o != nil && o.Handle != nil +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *UserUpdateAttributes) SetHandle(v string) { + o.Handle = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *UserUpdateAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasModifiedAt() bool { + return o != nil && o.ModifiedAt != nil +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *UserUpdateAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + // GetName returns the Name field value if set, zero value otherwise. func (o *UserUpdateAttributes) GetName() string { if o == nil || o.Name == nil { @@ -122,21 +220,142 @@ func (o *UserUpdateAttributes) SetName(v string) { o.Name = &v } +// GetServiceAccount returns the ServiceAccount field value if set, zero value otherwise. +func (o *UserUpdateAttributes) GetServiceAccount() bool { + if o == nil || o.ServiceAccount == nil { + var ret bool + return ret + } + return *o.ServiceAccount +} + +// GetServiceAccountOk returns a tuple with the ServiceAccount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateAttributes) GetServiceAccountOk() (*bool, bool) { + if o == nil || o.ServiceAccount == nil { + return nil, false + } + return o.ServiceAccount, true +} + +// HasServiceAccount returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasServiceAccount() bool { + return o != nil && o.ServiceAccount != nil +} + +// SetServiceAccount gets a reference to the given bool and assigns it to the ServiceAccount field. +func (o *UserUpdateAttributes) SetServiceAccount(v bool) { + o.ServiceAccount = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UserUpdateAttributes) GetTitle() string { + if o == nil || o.Title.Get() == nil { + var ret string + return ret + } + return *o.Title.Get() +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *UserUpdateAttributes) GetTitleOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Title.Get(), o.Title.IsSet() +} + +// HasTitle returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasTitle() bool { + return o != nil && o.Title.IsSet() +} + +// SetTitle gets a reference to the given datadog.NullableString and assigns it to the Title field. +func (o *UserUpdateAttributes) SetTitle(v string) { + o.Title.Set(&v) +} + +// SetTitleNil sets the value for Title to be an explicit nil. +func (o *UserUpdateAttributes) SetTitleNil() { + o.Title.Set(nil) +} + +// UnsetTitle ensures that no value is present for Title, not even an explicit nil. +func (o *UserUpdateAttributes) UnsetTitle() { + o.Title.Unset() +} + +// GetVerified returns the Verified field value if set, zero value otherwise. +func (o *UserUpdateAttributes) GetVerified() bool { + if o == nil || o.Verified == nil { + var ret bool + return ret + } + return *o.Verified +} + +// GetVerifiedOk returns a tuple with the Verified field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserUpdateAttributes) GetVerifiedOk() (*bool, bool) { + if o == nil || o.Verified == nil { + return nil, false + } + return o.Verified, true +} + +// HasVerified returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasVerified() bool { + return o != nil && o.Verified != nil +} + +// SetVerified gets a reference to the given bool and assigns it to the Verified field. +func (o *UserUpdateAttributes) SetVerified(v bool) { + o.Verified = &v +} + // MarshalJSON serializes the struct using spec logic. func (o UserUpdateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } + if o.CreatedAt != nil { + 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.Disabled != nil { toSerialize["disabled"] = o.Disabled } if o.Email != nil { toSerialize["email"] = o.Email } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } if o.Name != nil { toSerialize["name"] = o.Name } + if o.ServiceAccount != nil { + toSerialize["service_account"] = o.ServiceAccount + } + if o.Title.IsSet() { + toSerialize["title"] = o.Title.Get() + } + if o.Verified != nil { + toSerialize["verified"] = o.Verified + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -147,22 +366,34 @@ func (o UserUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Disabled *bool `json:"disabled,omitempty"` - Email *string `json:"email,omitempty"` - Name *string `json:"name,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email,omitempty"` + Handle *string `json:"handle,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name *string `json:"name,omitempty"` + ServiceAccount *bool `json:"service_account,omitempty"` + Title datadog.NullableString `json:"title,omitempty"` + Verified *bool `json:"verified,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"disabled", "email", "name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "disabled", "email", "handle", "modified_at", "name", "service_account", "title", "verified"}) } else { return err } + o.CreatedAt = all.CreatedAt o.Disabled = all.Disabled o.Email = all.Email + o.Handle = all.Handle + o.ModifiedAt = all.ModifiedAt o.Name = all.Name + o.ServiceAccount = all.ServiceAccount + o.Title = all.Title + o.Verified = all.Verified if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/tests/scenarios/features/v2/users.feature b/tests/scenarios/features/v2/users.feature index ce27d729985..3e1b1528104 100644 --- a/tests/scenarios/features/v2/users.feature +++ b/tests/scenarios/features/v2/users.feature @@ -151,7 +151,7 @@ Feature: Users Scenario: Update a user returns "Bad Request" response Given new "UpdateUser" request And request contains "user_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} + And body with value {"data": {"attributes": {"title": null}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} When the request is sent Then the response status is 400 Bad Request @@ -189,6 +189,6 @@ Feature: Users Scenario: Update a user returns "Unprocessable Entity" response Given new "UpdateUser" request And request contains "user_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} + And body with value {"data": {"attributes": {"title": null}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} When the request is sent Then the response status is 422 Unprocessable Entity