diff --git a/.apigentools-info b/.apigentools-info index 86f828fc1fb..4912e6d5213 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-30 14:37:39.238144", - "spec_repo_commit": "60bc9127" + "regenerated": "2024-09-30 16:06:34.727569", + "spec_repo_commit": "3c5d6057" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-30 14:37:39.252667", - "spec_repo_commit": "60bc9127" + "regenerated": "2024-09-30 16:06:34.742242", + "spec_repo_commit": "3c5d6057" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fc61f2c6e41..62c04555706 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -950,6 +950,64 @@ components: $ref: '#/components/schemas/AWSRelatedAccount' type: array type: object + AbbreviatedTeam: + description: The definition of `AbbreviatedTeam` object. + properties: + attributes: + $ref: '#/components/schemas/AbbreviatedTeamAttributes' + id: + description: ID of the team + type: string + type: + $ref: '#/components/schemas/AbbreviatedTeamType' + required: + - attributes + - type + type: object + AbbreviatedTeamAttributes: + description: The definition of `AbbreviatedTeamAttributes` object. + properties: + avatar: + description: Unicode representation of the avatar for the team, limited + to a single grapheme + nullable: true + type: string + banner: + description: Banner selection for the team + format: int64 + type: integer + handle: + description: The team's identifier + example: '' + type: string + handles: + description: The `AbbreviatedTeamAttributes` `handles`. + type: string + is_open_membership: + description: The `AbbreviatedTeamAttributes` `is_open_membership`. + readOnly: true + type: boolean + name: + description: The name of the team + example: '' + type: string + summary: + description: A brief summary of the team + readOnly: true + type: string + required: + - handle + - name + type: object + AbbreviatedTeamType: + default: team + description: The definition of `AbbreviatedTeamType` object. + enum: + - team + example: team + type: string + x-enum-varnames: + - TEAM ActiveBillingDimensionsAttributes: description: List of active billing dimensions. properties: @@ -17812,27 +17870,6 @@ components: - id - type type: object - RelationshipToUserTeamTeam: - description: Relationship between team membership and team - properties: - data: - $ref: '#/components/schemas/RelationshipToUserTeamTeamData' - required: - - data - type: object - RelationshipToUserTeamTeamData: - description: The team associated with the membership - properties: - id: - description: The ID of the team associated with the membership - example: d7e15d9d-d346-43da-81d8-3d9e71d9a5e9 - type: string - type: - $ref: '#/components/schemas/UserTeamTeamType' - required: - - id - - type - type: object RelationshipToUserTeamUser: description: Relationship between team membership and user properties: @@ -24823,8 +24860,8 @@ components: UserTeamIncluded: description: Included resources related to the team membership oneOf: - - $ref: '#/components/schemas/User' - - $ref: '#/components/schemas/Team' + - $ref: '#/components/schemas/AbbreviatedTeam' + - $ref: '#/components/schemas/UserTeamUser' UserTeamPermission: description: A user's permissions for a given team properties: @@ -24861,8 +24898,6 @@ components: UserTeamRelationships: description: Relationship between membership and a user properties: - team: - $ref: '#/components/schemas/RelationshipToUserTeamTeam' user: $ref: '#/components/schemas/RelationshipToUserTeamUser' type: object @@ -24893,15 +24928,6 @@ components: type: string x-enum-varnames: - ADMIN - UserTeamTeamType: - default: team - description: User team team type - enum: - - team - example: team - type: string - x-enum-varnames: - - TEAM UserTeamType: default: team_memberships description: Team membership type @@ -24929,6 +24955,42 @@ components: required: - data type: object + UserTeamUser: + description: The definition of `UserTeamUser` object. + properties: + attributes: + $ref: '#/components/schemas/UserTeamUserAttributes' + id: + description: The `UserTeamUser` ID. + type: string + type: + $ref: '#/components/schemas/UserTeamUserType' + required: + - type + type: object + UserTeamUserAttributes: + description: The definition of `UserTeamUserAttributes` object. + properties: + disabled: + description: The `UserTeamUserAttributes` `disabled`. + type: boolean + email: + description: The `UserTeamUserAttributes` `email`. + type: string + handle: + description: The `UserTeamUserAttributes` `handle`. + type: string + icon: + description: The `UserTeamUserAttributes` `icon`. + type: string + name: + description: The `UserTeamUserAttributes` `name`. + nullable: true + type: string + service_account: + description: The `UserTeamUserAttributes` `service_account`. + type: boolean + type: object UserTeamUserType: default: users description: User team user type @@ -38900,6 +38962,7 @@ paths: name: filter[keyword] required: false schema: + description: Search query, can be user email or name. type: string responses: '200': diff --git a/api/datadogV2/model_abbreviated_team.go b/api/datadogV2/model_abbreviated_team.go new file mode 100644 index 00000000000..9fe29dfc204 --- /dev/null +++ b/api/datadogV2/model_abbreviated_team.go @@ -0,0 +1,183 @@ +// 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" +) + +// AbbreviatedTeam The definition of `AbbreviatedTeam` object. +type AbbreviatedTeam struct { + // The definition of `AbbreviatedTeamAttributes` object. + Attributes AbbreviatedTeamAttributes `json:"attributes"` + // ID of the team + Id *string `json:"id,omitempty"` + // The definition of `AbbreviatedTeamType` object. + Type AbbreviatedTeamType `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:"-"` +} + +// NewAbbreviatedTeam instantiates a new AbbreviatedTeam 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 NewAbbreviatedTeam(attributes AbbreviatedTeamAttributes, typeVar AbbreviatedTeamType) *AbbreviatedTeam { + this := AbbreviatedTeam{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewAbbreviatedTeamWithDefaults instantiates a new AbbreviatedTeam 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 NewAbbreviatedTeamWithDefaults() *AbbreviatedTeam { + this := AbbreviatedTeam{} + var typeVar AbbreviatedTeamType = ABBREVIATEDTEAMTYPE_TEAM + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AbbreviatedTeam) GetAttributes() AbbreviatedTeamAttributes { + if o == nil { + var ret AbbreviatedTeamAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *AbbreviatedTeam) GetAttributesOk() (*AbbreviatedTeamAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AbbreviatedTeam) SetAttributes(v AbbreviatedTeamAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AbbreviatedTeam) 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 *AbbreviatedTeam) 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 *AbbreviatedTeam) 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 *AbbreviatedTeam) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *AbbreviatedTeam) GetType() AbbreviatedTeamType { + if o == nil { + var ret AbbreviatedTeamType + 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 *AbbreviatedTeam) GetTypeOk() (*AbbreviatedTeamType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AbbreviatedTeam) SetType(v AbbreviatedTeamType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AbbreviatedTeam) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 *AbbreviatedTeam) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AbbreviatedTeamAttributes `json:"attributes"` + Id *string `json:"id,omitempty"` + Type *AbbreviatedTeamType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if 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_abbreviated_team_attributes.go b/api/datadogV2/model_abbreviated_team_attributes.go new file mode 100644 index 00000000000..c431c51df2c --- /dev/null +++ b/api/datadogV2/model_abbreviated_team_attributes.go @@ -0,0 +1,319 @@ +// 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" +) + +// AbbreviatedTeamAttributes The definition of `AbbreviatedTeamAttributes` object. +type AbbreviatedTeamAttributes struct { + // Unicode representation of the avatar for the team, limited to a single grapheme + Avatar datadog.NullableString `json:"avatar,omitempty"` + // Banner selection for the team + Banner *int64 `json:"banner,omitempty"` + // The team's identifier + Handle string `json:"handle"` + // The `AbbreviatedTeamAttributes` `handles`. + Handles *string `json:"handles,omitempty"` + // The `AbbreviatedTeamAttributes` `is_open_membership`. + IsOpenMembership *bool `json:"is_open_membership,omitempty"` + // The name of the team + Name string `json:"name"` + // A brief summary of the team + Summary *string `json:"summary,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:"-"` +} + +// NewAbbreviatedTeamAttributes instantiates a new AbbreviatedTeamAttributes 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 NewAbbreviatedTeamAttributes(handle string, name string) *AbbreviatedTeamAttributes { + this := AbbreviatedTeamAttributes{} + this.Handle = handle + this.Name = name + return &this +} + +// NewAbbreviatedTeamAttributesWithDefaults instantiates a new AbbreviatedTeamAttributes 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 NewAbbreviatedTeamAttributesWithDefaults() *AbbreviatedTeamAttributes { + this := AbbreviatedTeamAttributes{} + return &this +} + +// GetAvatar returns the Avatar field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *AbbreviatedTeamAttributes) GetAvatar() string { + if o == nil || o.Avatar.Get() == nil { + var ret string + return ret + } + return *o.Avatar.Get() +} + +// GetAvatarOk returns a tuple with the Avatar 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 *AbbreviatedTeamAttributes) GetAvatarOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Avatar.Get(), o.Avatar.IsSet() +} + +// HasAvatar returns a boolean if a field has been set. +func (o *AbbreviatedTeamAttributes) HasAvatar() bool { + return o != nil && o.Avatar.IsSet() +} + +// SetAvatar gets a reference to the given datadog.NullableString and assigns it to the Avatar field. +func (o *AbbreviatedTeamAttributes) SetAvatar(v string) { + o.Avatar.Set(&v) +} + +// SetAvatarNil sets the value for Avatar to be an explicit nil. +func (o *AbbreviatedTeamAttributes) SetAvatarNil() { + o.Avatar.Set(nil) +} + +// UnsetAvatar ensures that no value is present for Avatar, not even an explicit nil. +func (o *AbbreviatedTeamAttributes) UnsetAvatar() { + o.Avatar.Unset() +} + +// GetBanner returns the Banner field value if set, zero value otherwise. +func (o *AbbreviatedTeamAttributes) GetBanner() int64 { + if o == nil || o.Banner == nil { + var ret int64 + return ret + } + return *o.Banner +} + +// GetBannerOk returns a tuple with the Banner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AbbreviatedTeamAttributes) GetBannerOk() (*int64, bool) { + if o == nil || o.Banner == nil { + return nil, false + } + return o.Banner, true +} + +// HasBanner returns a boolean if a field has been set. +func (o *AbbreviatedTeamAttributes) HasBanner() bool { + return o != nil && o.Banner != nil +} + +// SetBanner gets a reference to the given int64 and assigns it to the Banner field. +func (o *AbbreviatedTeamAttributes) SetBanner(v int64) { + o.Banner = &v +} + +// GetHandle returns the Handle field value. +func (o *AbbreviatedTeamAttributes) GetHandle() string { + if o == nil { + var ret string + return ret + } + return o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value +// and a boolean to check if the value has been set. +func (o *AbbreviatedTeamAttributes) GetHandleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Handle, true +} + +// SetHandle sets field value. +func (o *AbbreviatedTeamAttributes) SetHandle(v string) { + o.Handle = v +} + +// GetHandles returns the Handles field value if set, zero value otherwise. +func (o *AbbreviatedTeamAttributes) GetHandles() string { + if o == nil || o.Handles == nil { + var ret string + return ret + } + return *o.Handles +} + +// GetHandlesOk returns a tuple with the Handles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AbbreviatedTeamAttributes) GetHandlesOk() (*string, bool) { + if o == nil || o.Handles == nil { + return nil, false + } + return o.Handles, true +} + +// HasHandles returns a boolean if a field has been set. +func (o *AbbreviatedTeamAttributes) HasHandles() bool { + return o != nil && o.Handles != nil +} + +// SetHandles gets a reference to the given string and assigns it to the Handles field. +func (o *AbbreviatedTeamAttributes) SetHandles(v string) { + o.Handles = &v +} + +// GetIsOpenMembership returns the IsOpenMembership field value if set, zero value otherwise. +func (o *AbbreviatedTeamAttributes) GetIsOpenMembership() bool { + if o == nil || o.IsOpenMembership == nil { + var ret bool + return ret + } + return *o.IsOpenMembership +} + +// GetIsOpenMembershipOk returns a tuple with the IsOpenMembership field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AbbreviatedTeamAttributes) GetIsOpenMembershipOk() (*bool, bool) { + if o == nil || o.IsOpenMembership == nil { + return nil, false + } + return o.IsOpenMembership, true +} + +// HasIsOpenMembership returns a boolean if a field has been set. +func (o *AbbreviatedTeamAttributes) HasIsOpenMembership() bool { + return o != nil && o.IsOpenMembership != nil +} + +// SetIsOpenMembership gets a reference to the given bool and assigns it to the IsOpenMembership field. +func (o *AbbreviatedTeamAttributes) SetIsOpenMembership(v bool) { + o.IsOpenMembership = &v +} + +// GetName returns the Name field value. +func (o *AbbreviatedTeamAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AbbreviatedTeamAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *AbbreviatedTeamAttributes) SetName(v string) { + o.Name = v +} + +// GetSummary returns the Summary field value if set, zero value otherwise. +func (o *AbbreviatedTeamAttributes) GetSummary() string { + if o == nil || o.Summary == nil { + var ret string + return ret + } + return *o.Summary +} + +// GetSummaryOk returns a tuple with the Summary field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AbbreviatedTeamAttributes) GetSummaryOk() (*string, bool) { + if o == nil || o.Summary == nil { + return nil, false + } + return o.Summary, true +} + +// HasSummary returns a boolean if a field has been set. +func (o *AbbreviatedTeamAttributes) HasSummary() bool { + return o != nil && o.Summary != nil +} + +// SetSummary gets a reference to the given string and assigns it to the Summary field. +func (o *AbbreviatedTeamAttributes) SetSummary(v string) { + o.Summary = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AbbreviatedTeamAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Avatar.IsSet() { + toSerialize["avatar"] = o.Avatar.Get() + } + if o.Banner != nil { + toSerialize["banner"] = o.Banner + } + toSerialize["handle"] = o.Handle + if o.Handles != nil { + toSerialize["handles"] = o.Handles + } + if o.IsOpenMembership != nil { + toSerialize["is_open_membership"] = o.IsOpenMembership + } + toSerialize["name"] = o.Name + if o.Summary != nil { + toSerialize["summary"] = o.Summary + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AbbreviatedTeamAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Avatar datadog.NullableString `json:"avatar,omitempty"` + Banner *int64 `json:"banner,omitempty"` + Handle *string `json:"handle"` + Handles *string `json:"handles,omitempty"` + IsOpenMembership *bool `json:"is_open_membership,omitempty"` + Name *string `json:"name"` + Summary *string `json:"summary,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "handle", "handles", "is_open_membership", "name", "summary"}) + } else { + return err + } + o.Avatar = all.Avatar + o.Banner = all.Banner + o.Handle = *all.Handle + o.Handles = all.Handles + o.IsOpenMembership = all.IsOpenMembership + o.Name = *all.Name + o.Summary = all.Summary + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_abbreviated_team_type.go b/api/datadogV2/model_abbreviated_team_type.go new file mode 100644 index 00000000000..63de578c9d4 --- /dev/null +++ b/api/datadogV2/model_abbreviated_team_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" +) + +// AbbreviatedTeamType The definition of `AbbreviatedTeamType` object. +type AbbreviatedTeamType string + +// List of AbbreviatedTeamType. +const ( + ABBREVIATEDTEAMTYPE_TEAM AbbreviatedTeamType = "team" +) + +var allowedAbbreviatedTeamTypeEnumValues = []AbbreviatedTeamType{ + ABBREVIATEDTEAMTYPE_TEAM, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AbbreviatedTeamType) GetAllowedValues() []AbbreviatedTeamType { + return allowedAbbreviatedTeamTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AbbreviatedTeamType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AbbreviatedTeamType(value) + return nil +} + +// NewAbbreviatedTeamTypeFromValue returns a pointer to a valid AbbreviatedTeamType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAbbreviatedTeamTypeFromValue(v string) (*AbbreviatedTeamType, error) { + ev := AbbreviatedTeamType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AbbreviatedTeamType: valid values are %v", v, allowedAbbreviatedTeamTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AbbreviatedTeamType) IsValid() bool { + for _, existing := range allowedAbbreviatedTeamTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AbbreviatedTeamType value. +func (v AbbreviatedTeamType) Ptr() *AbbreviatedTeamType { + return &v +} diff --git a/api/datadogV2/model_relationship_to_user_team_team.go b/api/datadogV2/model_relationship_to_user_team_team.go deleted file mode 100644 index 3d1703e8ecd..00000000000 --- a/api/datadogV2/model_relationship_to_user_team_team.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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" -) - -// RelationshipToUserTeamTeam Relationship between team membership and team -type RelationshipToUserTeamTeam struct { - // The team associated with the membership - Data RelationshipToUserTeamTeamData `json:"data"` - // 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:"-"` -} - -// NewRelationshipToUserTeamTeam instantiates a new RelationshipToUserTeamTeam 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 NewRelationshipToUserTeamTeam(data RelationshipToUserTeamTeamData) *RelationshipToUserTeamTeam { - this := RelationshipToUserTeamTeam{} - this.Data = data - return &this -} - -// NewRelationshipToUserTeamTeamWithDefaults instantiates a new RelationshipToUserTeamTeam 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 NewRelationshipToUserTeamTeamWithDefaults() *RelationshipToUserTeamTeam { - this := RelationshipToUserTeamTeam{} - return &this -} - -// GetData returns the Data field value. -func (o *RelationshipToUserTeamTeam) GetData() RelationshipToUserTeamTeamData { - if o == nil { - var ret RelationshipToUserTeamTeamData - return ret - } - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *RelationshipToUserTeamTeam) GetDataOk() (*RelationshipToUserTeamTeamData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *RelationshipToUserTeamTeam) SetData(v RelationshipToUserTeamTeamData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToUserTeamTeam) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *RelationshipToUserTeamTeam) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Data *RelationshipToUserTeamTeamData `json:"data"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Data == nil { - return fmt.Errorf("required field data missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data"}) - } else { - return err - } - - hasInvalidField := false - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Data = *all.Data - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_relationship_to_user_team_team_data.go b/api/datadogV2/model_relationship_to_user_team_team_data.go deleted file mode 100644 index ab1bff6e002..00000000000 --- a/api/datadogV2/model_relationship_to_user_team_team_data.go +++ /dev/null @@ -1,145 +0,0 @@ -// 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" -) - -// RelationshipToUserTeamTeamData The team associated with the membership -type RelationshipToUserTeamTeamData struct { - // The ID of the team associated with the membership - Id string `json:"id"` - // User team team type - Type UserTeamTeamType `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:"-"` -} - -// NewRelationshipToUserTeamTeamData instantiates a new RelationshipToUserTeamTeamData 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 NewRelationshipToUserTeamTeamData(id string, typeVar UserTeamTeamType) *RelationshipToUserTeamTeamData { - this := RelationshipToUserTeamTeamData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewRelationshipToUserTeamTeamDataWithDefaults instantiates a new RelationshipToUserTeamTeamData 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 NewRelationshipToUserTeamTeamDataWithDefaults() *RelationshipToUserTeamTeamData { - this := RelationshipToUserTeamTeamData{} - var typeVar UserTeamTeamType = USERTEAMTEAMTYPE_TEAM - this.Type = typeVar - return &this -} - -// GetId returns the Id field value. -func (o *RelationshipToUserTeamTeamData) GetId() string { - if o == nil { - var ret string - return ret - } - return o.Id -} - -// GetIdOk returns a tuple with the Id field value -// and a boolean to check if the value has been set. -func (o *RelationshipToUserTeamTeamData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *RelationshipToUserTeamTeamData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *RelationshipToUserTeamTeamData) GetType() UserTeamTeamType { - if o == nil { - var ret UserTeamTeamType - 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 *RelationshipToUserTeamTeamData) GetTypeOk() (*UserTeamTeamType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *RelationshipToUserTeamTeamData) SetType(v UserTeamTeamType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o RelationshipToUserTeamTeamData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - 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 *RelationshipToUserTeamTeamData) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Id *string `json:"id"` - Type *UserTeamTeamType `json:"type"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Id == nil { - return fmt.Errorf("required field id missing") - } - if all.Type == nil { - return fmt.Errorf("required field type missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) - } else { - return err - } - - hasInvalidField := false - 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_team_included.go b/api/datadogV2/model_user_team_included.go index 393a20c398c..d0798130c33 100644 --- a/api/datadogV2/model_user_team_included.go +++ b/api/datadogV2/model_user_team_included.go @@ -10,65 +10,65 @@ import ( // UserTeamIncluded - Included resources related to the team membership type UserTeamIncluded struct { - User *User - Team *Team + AbbreviatedTeam *AbbreviatedTeam + UserTeamUser *UserTeamUser // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject interface{} } -// UserAsUserTeamIncluded is a convenience function that returns User wrapped in UserTeamIncluded. -func UserAsUserTeamIncluded(v *User) UserTeamIncluded { - return UserTeamIncluded{User: v} +// AbbreviatedTeamAsUserTeamIncluded is a convenience function that returns AbbreviatedTeam wrapped in UserTeamIncluded. +func AbbreviatedTeamAsUserTeamIncluded(v *AbbreviatedTeam) UserTeamIncluded { + return UserTeamIncluded{AbbreviatedTeam: v} } -// TeamAsUserTeamIncluded is a convenience function that returns Team wrapped in UserTeamIncluded. -func TeamAsUserTeamIncluded(v *Team) UserTeamIncluded { - return UserTeamIncluded{Team: v} +// UserTeamUserAsUserTeamIncluded is a convenience function that returns UserTeamUser wrapped in UserTeamIncluded. +func UserTeamUserAsUserTeamIncluded(v *UserTeamUser) UserTeamIncluded { + return UserTeamIncluded{UserTeamUser: v} } // UnmarshalJSON turns data into one of the pointers in the struct. func (obj *UserTeamIncluded) UnmarshalJSON(data []byte) error { var err error match := 0 - // try to unmarshal data into User - err = datadog.Unmarshal(data, &obj.User) + // try to unmarshal data into AbbreviatedTeam + err = datadog.Unmarshal(data, &obj.AbbreviatedTeam) if err == nil { - if obj.User != nil && obj.User.UnparsedObject == nil { - jsonUser, _ := datadog.Marshal(obj.User) - if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct - obj.User = nil + if obj.AbbreviatedTeam != nil && obj.AbbreviatedTeam.UnparsedObject == nil { + jsonAbbreviatedTeam, _ := datadog.Marshal(obj.AbbreviatedTeam) + if string(jsonAbbreviatedTeam) == "{}" { // empty struct + obj.AbbreviatedTeam = nil } else { match++ } } else { - obj.User = nil + obj.AbbreviatedTeam = nil } } else { - obj.User = nil + obj.AbbreviatedTeam = nil } - // try to unmarshal data into Team - err = datadog.Unmarshal(data, &obj.Team) + // try to unmarshal data into UserTeamUser + err = datadog.Unmarshal(data, &obj.UserTeamUser) if err == nil { - if obj.Team != nil && obj.Team.UnparsedObject == nil { - jsonTeam, _ := datadog.Marshal(obj.Team) - if string(jsonTeam) == "{}" { // empty struct - obj.Team = nil + if obj.UserTeamUser != nil && obj.UserTeamUser.UnparsedObject == nil { + jsonUserTeamUser, _ := datadog.Marshal(obj.UserTeamUser) + if string(jsonUserTeamUser) == "{}" { // empty struct + obj.UserTeamUser = nil } else { match++ } } else { - obj.Team = nil + obj.UserTeamUser = nil } } else { - obj.Team = nil + obj.UserTeamUser = nil } if match != 1 { // more than 1 match // reset to nil - obj.User = nil - obj.Team = nil + obj.AbbreviatedTeam = nil + obj.UserTeamUser = nil return datadog.Unmarshal(data, &obj.UnparsedObject) } return nil // exactly one match @@ -76,12 +76,12 @@ func (obj *UserTeamIncluded) UnmarshalJSON(data []byte) error { // MarshalJSON turns data from the first non-nil pointers in the struct to JSON. func (obj UserTeamIncluded) MarshalJSON() ([]byte, error) { - if obj.User != nil { - return datadog.Marshal(&obj.User) + if obj.AbbreviatedTeam != nil { + return datadog.Marshal(&obj.AbbreviatedTeam) } - if obj.Team != nil { - return datadog.Marshal(&obj.Team) + if obj.UserTeamUser != nil { + return datadog.Marshal(&obj.UserTeamUser) } if obj.UnparsedObject != nil { @@ -92,12 +92,12 @@ func (obj UserTeamIncluded) MarshalJSON() ([]byte, error) { // GetActualInstance returns the actual instance. func (obj *UserTeamIncluded) GetActualInstance() interface{} { - if obj.User != nil { - return obj.User + if obj.AbbreviatedTeam != nil { + return obj.AbbreviatedTeam } - if obj.Team != nil { - return obj.Team + if obj.UserTeamUser != nil { + return obj.UserTeamUser } // all schemas are nil diff --git a/api/datadogV2/model_user_team_relationships.go b/api/datadogV2/model_user_team_relationships.go index 01631827b49..0650d49aacb 100644 --- a/api/datadogV2/model_user_team_relationships.go +++ b/api/datadogV2/model_user_team_relationships.go @@ -10,8 +10,6 @@ import ( // UserTeamRelationships Relationship between membership and a user type UserTeamRelationships struct { - // Relationship between team membership and team - Team *RelationshipToUserTeamTeam `json:"team,omitempty"` // Relationship between team membership and user User *RelationshipToUserTeamUser `json:"user,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -36,34 +34,6 @@ func NewUserTeamRelationshipsWithDefaults() *UserTeamRelationships { return &this } -// GetTeam returns the Team field value if set, zero value otherwise. -func (o *UserTeamRelationships) GetTeam() RelationshipToUserTeamTeam { - if o == nil || o.Team == nil { - var ret RelationshipToUserTeamTeam - return ret - } - return *o.Team -} - -// GetTeamOk returns a tuple with the Team field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UserTeamRelationships) GetTeamOk() (*RelationshipToUserTeamTeam, bool) { - if o == nil || o.Team == nil { - return nil, false - } - return o.Team, true -} - -// HasTeam returns a boolean if a field has been set. -func (o *UserTeamRelationships) HasTeam() bool { - return o != nil && o.Team != nil -} - -// SetTeam gets a reference to the given RelationshipToUserTeamTeam and assigns it to the Team field. -func (o *UserTeamRelationships) SetTeam(v RelationshipToUserTeamTeam) { - o.Team = &v -} - // GetUser returns the User field value if set, zero value otherwise. func (o *UserTeamRelationships) GetUser() RelationshipToUserTeamUser { if o == nil || o.User == nil { @@ -98,9 +68,6 @@ func (o UserTeamRelationships) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - if o.Team != nil { - toSerialize["team"] = o.Team - } if o.User != nil { toSerialize["user"] = o.User } @@ -114,7 +81,6 @@ func (o UserTeamRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Team *RelationshipToUserTeamTeam `json:"team,omitempty"` User *RelationshipToUserTeamUser `json:"user,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { @@ -122,16 +88,12 @@ func (o *UserTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"team", "user"}) + datadog.DeleteKeys(additionalProperties, &[]string{"user"}) } else { return err } hasInvalidField := false - if all.Team != nil && all.Team.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Team = all.Team if all.User != nil && all.User.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } diff --git a/api/datadogV2/model_user_team_team_type.go b/api/datadogV2/model_user_team_team_type.go deleted file mode 100644 index eb22038ff86..00000000000 --- a/api/datadogV2/model_user_team_team_type.go +++ /dev/null @@ -1,64 +0,0 @@ -// 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" -) - -// UserTeamTeamType User team team type -type UserTeamTeamType string - -// List of UserTeamTeamType. -const ( - USERTEAMTEAMTYPE_TEAM UserTeamTeamType = "team" -) - -var allowedUserTeamTeamTypeEnumValues = []UserTeamTeamType{ - USERTEAMTEAMTYPE_TEAM, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *UserTeamTeamType) GetAllowedValues() []UserTeamTeamType { - return allowedUserTeamTeamTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *UserTeamTeamType) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = UserTeamTeamType(value) - return nil -} - -// NewUserTeamTeamTypeFromValue returns a pointer to a valid UserTeamTeamType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewUserTeamTeamTypeFromValue(v string) (*UserTeamTeamType, error) { - ev := UserTeamTeamType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for UserTeamTeamType: valid values are %v", v, allowedUserTeamTeamTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v UserTeamTeamType) IsValid() bool { - for _, existing := range allowedUserTeamTeamTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to UserTeamTeamType value. -func (v UserTeamTeamType) Ptr() *UserTeamTeamType { - return &v -} diff --git a/api/datadogV2/model_user_team_user.go b/api/datadogV2/model_user_team_user.go new file mode 100644 index 00000000000..87709a5f7a0 --- /dev/null +++ b/api/datadogV2/model_user_team_user.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" +) + +// UserTeamUser The definition of `UserTeamUser` object. +type UserTeamUser struct { + // The definition of `UserTeamUserAttributes` object. + Attributes *UserTeamUserAttributes `json:"attributes,omitempty"` + // The `UserTeamUser` ID. + Id *string `json:"id,omitempty"` + // User team user type + Type UserTeamUserType `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:"-"` +} + +// NewUserTeamUser instantiates a new UserTeamUser 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 NewUserTeamUser(typeVar UserTeamUserType) *UserTeamUser { + this := UserTeamUser{} + this.Type = typeVar + return &this +} + +// NewUserTeamUserWithDefaults instantiates a new UserTeamUser 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 NewUserTeamUserWithDefaults() *UserTeamUser { + this := UserTeamUser{} + var typeVar UserTeamUserType = USERTEAMUSERTYPE_USERS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UserTeamUser) GetAttributes() UserTeamUserAttributes { + if o == nil || o.Attributes == nil { + var ret UserTeamUserAttributes + 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 *UserTeamUser) GetAttributesOk() (*UserTeamUserAttributes, 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 *UserTeamUser) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given UserTeamUserAttributes and assigns it to the Attributes field. +func (o *UserTeamUser) SetAttributes(v UserTeamUserAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UserTeamUser) 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 *UserTeamUser) 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 *UserTeamUser) 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 *UserTeamUser) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *UserTeamUser) GetType() UserTeamUserType { + if o == nil { + var ret UserTeamUserType + 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 *UserTeamUser) GetTypeOk() (*UserTeamUserType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UserTeamUser) SetType(v UserTeamUserType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserTeamUser) 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 *UserTeamUser) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UserTeamUserAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UserTeamUserType `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_team_user_attributes.go b/api/datadogV2/model_user_team_user_attributes.go new file mode 100644 index 00000000000..8b26c255d9c --- /dev/null +++ b/api/datadogV2/model_user_team_user_attributes.go @@ -0,0 +1,288 @@ +// 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" +) + +// UserTeamUserAttributes The definition of `UserTeamUserAttributes` object. +type UserTeamUserAttributes struct { + // The `UserTeamUserAttributes` `disabled`. + Disabled *bool `json:"disabled,omitempty"` + // The `UserTeamUserAttributes` `email`. + Email *string `json:"email,omitempty"` + // The `UserTeamUserAttributes` `handle`. + Handle *string `json:"handle,omitempty"` + // The `UserTeamUserAttributes` `icon`. + Icon *string `json:"icon,omitempty"` + // The `UserTeamUserAttributes` `name`. + Name datadog.NullableString `json:"name,omitempty"` + // The `UserTeamUserAttributes` `service_account`. + ServiceAccount *bool `json:"service_account,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:"-"` +} + +// NewUserTeamUserAttributes instantiates a new UserTeamUserAttributes 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 NewUserTeamUserAttributes() *UserTeamUserAttributes { + this := UserTeamUserAttributes{} + return &this +} + +// NewUserTeamUserAttributesWithDefaults instantiates a new UserTeamUserAttributes 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 NewUserTeamUserAttributesWithDefaults() *UserTeamUserAttributes { + this := UserTeamUserAttributes{} + return &this +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *UserTeamUserAttributes) 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 *UserTeamUserAttributes) 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 *UserTeamUserAttributes) 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 *UserTeamUserAttributes) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *UserTeamUserAttributes) 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 *UserTeamUserAttributes) 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 *UserTeamUserAttributes) 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 *UserTeamUserAttributes) SetEmail(v string) { + o.Email = &v +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *UserTeamUserAttributes) 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 *UserTeamUserAttributes) 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 *UserTeamUserAttributes) 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 *UserTeamUserAttributes) SetHandle(v string) { + o.Handle = &v +} + +// GetIcon returns the Icon field value if set, zero value otherwise. +func (o *UserTeamUserAttributes) GetIcon() string { + if o == nil || o.Icon == nil { + var ret string + return ret + } + return *o.Icon +} + +// GetIconOk returns a tuple with the Icon field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UserTeamUserAttributes) GetIconOk() (*string, bool) { + if o == nil || o.Icon == nil { + return nil, false + } + return o.Icon, true +} + +// HasIcon returns a boolean if a field has been set. +func (o *UserTeamUserAttributes) HasIcon() bool { + return o != nil && o.Icon != nil +} + +// SetIcon gets a reference to the given string and assigns it to the Icon field. +func (o *UserTeamUserAttributes) SetIcon(v string) { + o.Icon = &v +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UserTeamUserAttributes) GetName() string { + if o == nil || o.Name.Get() == nil { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name 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 *UserTeamUserAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *UserTeamUserAttributes) HasName() bool { + return o != nil && o.Name.IsSet() +} + +// SetName gets a reference to the given datadog.NullableString and assigns it to the Name field. +func (o *UserTeamUserAttributes) SetName(v string) { + o.Name.Set(&v) +} + +// SetNameNil sets the value for Name to be an explicit nil. +func (o *UserTeamUserAttributes) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil. +func (o *UserTeamUserAttributes) UnsetName() { + o.Name.Unset() +} + +// GetServiceAccount returns the ServiceAccount field value if set, zero value otherwise. +func (o *UserTeamUserAttributes) 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 *UserTeamUserAttributes) 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 *UserTeamUserAttributes) 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 *UserTeamUserAttributes) SetServiceAccount(v bool) { + o.ServiceAccount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserTeamUserAttributes) 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.Handle != nil { + toSerialize["handle"] = o.Handle + } + if o.Icon != nil { + toSerialize["icon"] = o.Icon + } + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + if o.ServiceAccount != nil { + toSerialize["service_account"] = o.ServiceAccount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserTeamUserAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email,omitempty"` + Handle *string `json:"handle,omitempty"` + Icon *string `json:"icon,omitempty"` + Name datadog.NullableString `json:"name,omitempty"` + ServiceAccount *bool `json:"service_account,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", "handle", "icon", "name", "service_account"}) + } else { + return err + } + o.Disabled = all.Disabled + o.Email = all.Email + o.Handle = all.Handle + o.Icon = all.Icon + o.Name = all.Name + o.ServiceAccount = all.ServiceAccount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/teams/CreateTeamMembership.go b/examples/v2/teams/CreateTeamMembership.go index 740ba71a32b..975c4e13725 100644 --- a/examples/v2/teams/CreateTeamMembership.go +++ b/examples/v2/teams/CreateTeamMembership.go @@ -19,12 +19,6 @@ func main() { Role: *datadogV2.NewNullableUserTeamRole(datadogV2.USERTEAMROLE_ADMIN.Ptr()), }, Relationships: &datadogV2.UserTeamRelationships{ - Team: &datadogV2.RelationshipToUserTeamTeam{ - Data: datadogV2.RelationshipToUserTeamTeamData{ - Id: "d7e15d9d-d346-43da-81d8-3d9e71d9a5e9", - Type: datadogV2.USERTEAMTEAMTYPE_TEAM, - }, - }, User: &datadogV2.RelationshipToUserTeamUser{ Data: datadogV2.RelationshipToUserTeamUserData{ Id: "b8626d7e-cedd-11eb-abf5-da7ad0900001", diff --git a/tests/scenarios/features/v2/teams.feature b/tests/scenarios/features/v2/teams.feature index 5d4069034c9..e60c4d8f4e9 100644 --- a/tests/scenarios/features/v2/teams.feature +++ b/tests/scenarios/features/v2/teams.feature @@ -13,7 +13,7 @@ Feature: Teams Scenario: Add a user to a team returns "API error response." response Given new "CreateTeamMembership" request And request contains "team_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"team": {"data": {"id": "d7e15d9d-d346-43da-81d8-3d9e71d9a5e9", "type": "team"}}, "user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} + And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} When the request is sent Then the response status is 409 API error response. @@ -21,7 +21,7 @@ Feature: Teams Scenario: Add a user to a team returns "Represents a user's association to a team" response Given new "CreateTeamMembership" request And request contains "team_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"team": {"data": {"id": "d7e15d9d-d346-43da-81d8-3d9e71d9a5e9", "type": "team"}}, "user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} + And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} When the request is sent Then the response status is 200 Represents a user's association to a team