diff --git a/.apigentools-info b/.apigentools-info index 567b048fb1c..c30de930ef5 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-02-24 14:19:07.230112", - "spec_repo_commit": "b34a35ef" + "regenerated": "2025-02-25 17:19:35.598368", + "spec_repo_commit": "7b09d7dd" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-02-24 14:19:07.246168", - "spec_repo_commit": "b34a35ef" + "regenerated": "2025-02-25 17:19:35.613826", + "spec_repo_commit": "7b09d7dd" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 595a7442a15..e8484e042b1 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1451,11 +1451,13 @@ components: enum: - open - invite + - embed nullable: true type: string x-enum-varnames: - OPEN - INVITE + - EMBED DashboardSummary: description: Dashboard summary response. properties: @@ -13047,7 +13049,7 @@ components: properties: author: $ref: '#/components/schemas/SharedDashboardAuthor' - created_at: + created: description: Date the dashboard was shared. format: date-time readOnly: true @@ -13058,6 +13060,20 @@ components: type: string dashboard_type: $ref: '#/components/schemas/DashboardType' + embeddable_domains: + description: The `SharedDashboard` `embeddable_domains`. + example: + - https://domain.atlassian.net/ + - http://myserver.com/ + items: + description: The allowlisted referrers for an EMBED shared dashboard. + type: string + type: array + expiration: + description: The time when an OPEN shared dashboard becomes publicly unavailable. + format: date-time + nullable: true + type: string global_time: $ref: '#/components/schemas/DashboardGlobalTime' global_time_selectable_enabled: @@ -13065,6 +13081,23 @@ components: setting for the shared dashboard. nullable: true type: boolean + invitees: + description: The `SharedDashboard` `invitees`. + example: + - access_expiration: '2030-01-01T12:00:00.00Z' + email: test@datadoghq.com + - access_expiration: null + email: test2@datadoghq.com + items: + $ref: '#/components/schemas/SharedDashboardInviteesItems' + type: array + last_accessed: + description: The last time the shared dashboard was accessed. Null if never + accessed. + format: date-time + nullable: true + readOnly: true + type: string public_url: description: URL of the shared dashboard. readOnly: true @@ -13084,6 +13117,7 @@ components: nullable: true type: array share_list: + deprecated: true description: List of email addresses that can receive an invitation to access to the shared dashboard. example: @@ -13097,10 +13131,17 @@ components: type: array share_type: $ref: '#/components/schemas/DashboardShareType' + status: + $ref: '#/components/schemas/SharedDashboardStatus' + title: + description: Title of the shared dashboard. + type: string token: description: A unique token assigned to the shared dashboard. readOnly: true type: string + viewing_preferences: + $ref: '#/components/schemas/ViewingPreferences' required: - dashboard_id - dashboard_type @@ -13120,6 +13161,27 @@ components: type: string readOnly: true type: object + SharedDashboardInviteesItems: + description: The allowlisted invitees for an INVITE-only shared dashboard. + properties: + access_expiration: + description: Time of the invitee expiration. Null means the invite will + not expire. + format: date-time + nullable: true + type: string + created_at: + description: Time that the invitee was created. + format: date-time + readOnly: true + type: string + email: + description: Email of the invitee. + example: test@datadoghq.com + type: string + required: + - email + type: object SharedDashboardInvites: description: Invitations data and metadata that exists for a shared dashboard returned by the API. @@ -13236,6 +13298,17 @@ components: format: int64 type: integer type: object + SharedDashboardStatus: + description: Active means the dashboard is publicly available. Paused means + the dashboard is not publicly available. + enum: + - active + - paused + example: active + type: string + x-enum-varnames: + - ACTIVE + - PAUSED SharedDashboardUpdateRequest: description: Update a shared dashboard's settings. example: @@ -13246,6 +13319,20 @@ components: - test2@datadoghq.com share_type: invite properties: + embeddable_domains: + description: The `SharedDashboard` `embeddable_domains`. + example: + - https://domain.atlassian.net/ + - http://myserver.com/ + items: + description: The allowlisted referrers for an EMBED shared dashboard. + type: string + type: array + expiration: + description: The time when an OPEN shared dashboard becomes publicly unavailable. + format: date-time + nullable: true + type: string global_time: $ref: '#/components/schemas/SharedDashboardUpdateRequestGlobalTime' global_time_selectable_enabled: @@ -13253,6 +13340,16 @@ components: setting for the shared dashboard. nullable: true type: boolean + invitees: + description: The `SharedDashboard` `invitees`. + example: + - access_expiration: '2030-01-01T12:00:00.00Z' + email: test@datadoghq.com + - access_expiration: null + email: test2@datadoghq.com + items: + $ref: '#/components/schemas/SharedDashboardInviteesItems' + type: array selectable_template_vars: description: List of objects representing template variables on the shared dashboard which can have selectable values. @@ -13268,6 +13365,7 @@ components: nullable: true type: array share_list: + deprecated: true description: List of email addresses that can be given access to the shared dashboard. example: @@ -13281,8 +13379,13 @@ components: type: array share_type: $ref: '#/components/schemas/DashboardShareType' - required: - - global_time + status: + $ref: '#/components/schemas/SharedDashboardStatus' + title: + description: Title of the shared dashboard. + type: string + viewing_preferences: + $ref: '#/components/schemas/ViewingPreferences' type: object SharedDashboardUpdateRequestGlobalTime: description: Timeframe setting for the shared dashboard. @@ -22710,6 +22813,28 @@ components: example: 0 format: int64 type: integer + ViewingPreferences: + description: The viewing preferences for a shared dashboard. + properties: + high_density: + description: Whether the widgets on the shared dashboard should be displayed + with high density. + type: boolean + theme: + $ref: '#/components/schemas/ViewingPreferencesTheme' + type: object + ViewingPreferencesTheme: + description: The theme of the shared dashboard view. "system" follows your system's + default viewing theme. + enum: + - system + - light + - dark + type: string + x-enum-varnames: + - SYSTEM + - LIGHT + - DARK WebhooksIntegration: description: Datadog-Webhooks integration. properties: diff --git a/api/datadogV1/model_dashboard_share_type.go b/api/datadogV1/model_dashboard_share_type.go index 69f83182d3a..e47ba3bc4a6 100644 --- a/api/datadogV1/model_dashboard_share_type.go +++ b/api/datadogV1/model_dashboard_share_type.go @@ -17,11 +17,13 @@ type DashboardShareType string const ( DASHBOARDSHARETYPE_OPEN DashboardShareType = "open" DASHBOARDSHARETYPE_INVITE DashboardShareType = "invite" + DASHBOARDSHARETYPE_EMBED DashboardShareType = "embed" ) var allowedDashboardShareTypeEnumValues = []DashboardShareType{ DASHBOARDSHARETYPE_OPEN, DASHBOARDSHARETYPE_INVITE, + DASHBOARDSHARETYPE_EMBED, } // GetAllowedValues reeturns the list of possible values. diff --git a/api/datadogV1/model_shared_dashboard.go b/api/datadogV1/model_shared_dashboard.go index 039e7062506..6c3f9db5b3b 100644 --- a/api/datadogV1/model_shared_dashboard.go +++ b/api/datadogV1/model_shared_dashboard.go @@ -16,25 +16,40 @@ type SharedDashboard struct { // User who shared the dashboard. Author *SharedDashboardAuthor `json:"author,omitempty"` // Date the dashboard was shared. - CreatedAt *time.Time `json:"created_at,omitempty"` + Created *time.Time `json:"created,omitempty"` // ID of the dashboard to share. DashboardId string `json:"dashboard_id"` // The type of the associated private dashboard. DashboardType DashboardType `json:"dashboard_type"` + // The `SharedDashboard` `embeddable_domains`. + EmbeddableDomains []string `json:"embeddable_domains,omitempty"` + // The time when an OPEN shared dashboard becomes publicly unavailable. + Expiration datadog.NullableTime `json:"expiration,omitempty"` // Object containing the live span selection for the dashboard. GlobalTime *DashboardGlobalTime `json:"global_time,omitempty"` // Whether to allow viewers to select a different global time setting for the shared dashboard. GlobalTimeSelectableEnabled datadog.NullableBool `json:"global_time_selectable_enabled,omitempty"` + // The `SharedDashboard` `invitees`. + Invitees []SharedDashboardInviteesItems `json:"invitees,omitempty"` + // The last time the shared dashboard was accessed. Null if never accessed. + LastAccessed datadog.NullableTime `json:"last_accessed,omitempty"` // URL of the shared dashboard. PublicUrl *string `json:"public_url,omitempty"` // List of objects representing template variables on the shared dashboard which can have selectable values. SelectableTemplateVars []SelectableTemplateVariableItems `json:"selectable_template_vars,omitempty"` // List of email addresses that can receive an invitation to access to the shared dashboard. + // Deprecated ShareList datadog.NullableList[string] `json:"share_list,omitempty"` // Type of sharing access (either open to anyone who has the public URL or invite-only). ShareType NullableDashboardShareType `json:"share_type,omitempty"` + // Active means the dashboard is publicly available. Paused means the dashboard is not publicly available. + Status *SharedDashboardStatus `json:"status,omitempty"` + // Title of the shared dashboard. + Title *string `json:"title,omitempty"` // A unique token assigned to the shared dashboard. Token *string `json:"token,omitempty"` + // The viewing preferences for a shared dashboard. + ViewingPreferences *ViewingPreferences `json:"viewing_preferences,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:"-"` @@ -87,32 +102,32 @@ func (o *SharedDashboard) SetAuthor(v SharedDashboardAuthor) { o.Author = &v } -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *SharedDashboard) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *SharedDashboard) GetCreated() time.Time { + if o == nil || o.Created == nil { var ret time.Time return ret } - return *o.CreatedAt + return *o.Created } -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *SharedDashboard) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { +func (o *SharedDashboard) GetCreatedOk() (*time.Time, bool) { + if o == nil || o.Created == nil { return nil, false } - return o.CreatedAt, true + return o.Created, true } -// HasCreatedAt returns a boolean if a field has been set. -func (o *SharedDashboard) HasCreatedAt() bool { - return o != nil && o.CreatedAt != nil +// HasCreated returns a boolean if a field has been set. +func (o *SharedDashboard) HasCreated() bool { + return o != nil && o.Created != nil } -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. -func (o *SharedDashboard) SetCreatedAt(v time.Time) { - o.CreatedAt = &v +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *SharedDashboard) SetCreated(v time.Time) { + o.Created = &v } // GetDashboardId returns the DashboardId field value. @@ -161,6 +176,73 @@ func (o *SharedDashboard) SetDashboardType(v DashboardType) { o.DashboardType = v } +// GetEmbeddableDomains returns the EmbeddableDomains field value if set, zero value otherwise. +func (o *SharedDashboard) GetEmbeddableDomains() []string { + if o == nil || o.EmbeddableDomains == nil { + var ret []string + return ret + } + return o.EmbeddableDomains +} + +// GetEmbeddableDomainsOk returns a tuple with the EmbeddableDomains field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SharedDashboard) GetEmbeddableDomainsOk() (*[]string, bool) { + if o == nil || o.EmbeddableDomains == nil { + return nil, false + } + return &o.EmbeddableDomains, true +} + +// HasEmbeddableDomains returns a boolean if a field has been set. +func (o *SharedDashboard) HasEmbeddableDomains() bool { + return o != nil && o.EmbeddableDomains != nil +} + +// SetEmbeddableDomains gets a reference to the given []string and assigns it to the EmbeddableDomains field. +func (o *SharedDashboard) SetEmbeddableDomains(v []string) { + o.EmbeddableDomains = v +} + +// GetExpiration returns the Expiration field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SharedDashboard) GetExpiration() time.Time { + if o == nil || o.Expiration.Get() == nil { + var ret time.Time + return ret + } + return *o.Expiration.Get() +} + +// GetExpirationOk returns a tuple with the Expiration 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 *SharedDashboard) GetExpirationOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Expiration.Get(), o.Expiration.IsSet() +} + +// HasExpiration returns a boolean if a field has been set. +func (o *SharedDashboard) HasExpiration() bool { + return o != nil && o.Expiration.IsSet() +} + +// SetExpiration gets a reference to the given datadog.NullableTime and assigns it to the Expiration field. +func (o *SharedDashboard) SetExpiration(v time.Time) { + o.Expiration.Set(&v) +} + +// SetExpirationNil sets the value for Expiration to be an explicit nil. +func (o *SharedDashboard) SetExpirationNil() { + o.Expiration.Set(nil) +} + +// UnsetExpiration ensures that no value is present for Expiration, not even an explicit nil. +func (o *SharedDashboard) UnsetExpiration() { + o.Expiration.Unset() +} + // GetGlobalTime returns the GlobalTime field value if set, zero value otherwise. func (o *SharedDashboard) GetGlobalTime() DashboardGlobalTime { if o == nil || o.GlobalTime == nil { @@ -228,6 +310,73 @@ func (o *SharedDashboard) UnsetGlobalTimeSelectableEnabled() { o.GlobalTimeSelectableEnabled.Unset() } +// GetInvitees returns the Invitees field value if set, zero value otherwise. +func (o *SharedDashboard) GetInvitees() []SharedDashboardInviteesItems { + if o == nil || o.Invitees == nil { + var ret []SharedDashboardInviteesItems + return ret + } + return o.Invitees +} + +// GetInviteesOk returns a tuple with the Invitees field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SharedDashboard) GetInviteesOk() (*[]SharedDashboardInviteesItems, bool) { + if o == nil || o.Invitees == nil { + return nil, false + } + return &o.Invitees, true +} + +// HasInvitees returns a boolean if a field has been set. +func (o *SharedDashboard) HasInvitees() bool { + return o != nil && o.Invitees != nil +} + +// SetInvitees gets a reference to the given []SharedDashboardInviteesItems and assigns it to the Invitees field. +func (o *SharedDashboard) SetInvitees(v []SharedDashboardInviteesItems) { + o.Invitees = v +} + +// GetLastAccessed returns the LastAccessed field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SharedDashboard) GetLastAccessed() time.Time { + if o == nil || o.LastAccessed.Get() == nil { + var ret time.Time + return ret + } + return *o.LastAccessed.Get() +} + +// GetLastAccessedOk returns a tuple with the LastAccessed 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 *SharedDashboard) GetLastAccessedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastAccessed.Get(), o.LastAccessed.IsSet() +} + +// HasLastAccessed returns a boolean if a field has been set. +func (o *SharedDashboard) HasLastAccessed() bool { + return o != nil && o.LastAccessed.IsSet() +} + +// SetLastAccessed gets a reference to the given datadog.NullableTime and assigns it to the LastAccessed field. +func (o *SharedDashboard) SetLastAccessed(v time.Time) { + o.LastAccessed.Set(&v) +} + +// SetLastAccessedNil sets the value for LastAccessed to be an explicit nil. +func (o *SharedDashboard) SetLastAccessedNil() { + o.LastAccessed.Set(nil) +} + +// UnsetLastAccessed ensures that no value is present for LastAccessed, not even an explicit nil. +func (o *SharedDashboard) UnsetLastAccessed() { + o.LastAccessed.Unset() +} + // GetPublicUrl returns the PublicUrl field value if set, zero value otherwise. func (o *SharedDashboard) GetPublicUrl() string { if o == nil || o.PublicUrl == nil { @@ -286,6 +435,7 @@ func (o *SharedDashboard) SetSelectableTemplateVars(v []SelectableTemplateVariab } // GetShareList returns the ShareList field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated func (o *SharedDashboard) GetShareList() []string { if o == nil || o.ShareList.Get() == nil { var ret []string @@ -297,6 +447,7 @@ func (o *SharedDashboard) GetShareList() []string { // GetShareListOk returns a tuple with the ShareList 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. +// Deprecated func (o *SharedDashboard) GetShareListOk() (*[]string, bool) { if o == nil { return nil, false @@ -310,6 +461,7 @@ func (o *SharedDashboard) HasShareList() bool { } // SetShareList gets a reference to the given datadog.NullableList[string] and assigns it to the ShareList field. +// Deprecated func (o *SharedDashboard) SetShareList(v []string) { o.ShareList.Set(&v) } @@ -363,6 +515,62 @@ func (o *SharedDashboard) UnsetShareType() { o.ShareType.Unset() } +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SharedDashboard) GetStatus() SharedDashboardStatus { + if o == nil || o.Status == nil { + var ret SharedDashboardStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SharedDashboard) GetStatusOk() (*SharedDashboardStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SharedDashboard) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given SharedDashboardStatus and assigns it to the Status field. +func (o *SharedDashboard) SetStatus(v SharedDashboardStatus) { + o.Status = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *SharedDashboard) 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 *SharedDashboard) 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 *SharedDashboard) 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 *SharedDashboard) SetTitle(v string) { + o.Title = &v +} + // GetToken returns the Token field value if set, zero value otherwise. func (o *SharedDashboard) GetToken() string { if o == nil || o.Token == nil { @@ -391,6 +599,34 @@ func (o *SharedDashboard) SetToken(v string) { o.Token = &v } +// GetViewingPreferences returns the ViewingPreferences field value if set, zero value otherwise. +func (o *SharedDashboard) GetViewingPreferences() ViewingPreferences { + if o == nil || o.ViewingPreferences == nil { + var ret ViewingPreferences + return ret + } + return *o.ViewingPreferences +} + +// GetViewingPreferencesOk returns a tuple with the ViewingPreferences field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SharedDashboard) GetViewingPreferencesOk() (*ViewingPreferences, bool) { + if o == nil || o.ViewingPreferences == nil { + return nil, false + } + return o.ViewingPreferences, true +} + +// HasViewingPreferences returns a boolean if a field has been set. +func (o *SharedDashboard) HasViewingPreferences() bool { + return o != nil && o.ViewingPreferences != nil +} + +// SetViewingPreferences gets a reference to the given ViewingPreferences and assigns it to the ViewingPreferences field. +func (o *SharedDashboard) SetViewingPreferences(v ViewingPreferences) { + o.ViewingPreferences = &v +} + // MarshalJSON serializes the struct using spec logic. func (o SharedDashboard) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -400,21 +636,33 @@ func (o SharedDashboard) MarshalJSON() ([]byte, error) { if o.Author != nil { toSerialize["author"] = o.Author } - if o.CreatedAt != nil { - if o.CreatedAt.Nanosecond() == 0 { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + if o.Created != nil { + if o.Created.Nanosecond() == 0 { + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00") } else { - toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00") } } toSerialize["dashboard_id"] = o.DashboardId toSerialize["dashboard_type"] = o.DashboardType + if o.EmbeddableDomains != nil { + toSerialize["embeddable_domains"] = o.EmbeddableDomains + } + if o.Expiration.IsSet() { + toSerialize["expiration"] = o.Expiration.Get() + } if o.GlobalTime != nil { toSerialize["global_time"] = o.GlobalTime } if o.GlobalTimeSelectableEnabled.IsSet() { toSerialize["global_time_selectable_enabled"] = o.GlobalTimeSelectableEnabled.Get() } + if o.Invitees != nil { + toSerialize["invitees"] = o.Invitees + } + if o.LastAccessed.IsSet() { + toSerialize["last_accessed"] = o.LastAccessed.Get() + } if o.PublicUrl != nil { toSerialize["public_url"] = o.PublicUrl } @@ -427,9 +675,18 @@ func (o SharedDashboard) MarshalJSON() ([]byte, error) { if o.ShareType.IsSet() { toSerialize["share_type"] = o.ShareType.Get() } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Title != nil { + toSerialize["title"] = o.Title + } if o.Token != nil { toSerialize["token"] = o.Token } + if o.ViewingPreferences != nil { + toSerialize["viewing_preferences"] = o.ViewingPreferences + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -441,16 +698,23 @@ func (o SharedDashboard) MarshalJSON() ([]byte, error) { func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { all := struct { Author *SharedDashboardAuthor `json:"author,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` + Created *time.Time `json:"created,omitempty"` DashboardId *string `json:"dashboard_id"` DashboardType *DashboardType `json:"dashboard_type"` + EmbeddableDomains []string `json:"embeddable_domains,omitempty"` + Expiration datadog.NullableTime `json:"expiration,omitempty"` GlobalTime *DashboardGlobalTime `json:"global_time,omitempty"` GlobalTimeSelectableEnabled datadog.NullableBool `json:"global_time_selectable_enabled,omitempty"` + Invitees []SharedDashboardInviteesItems `json:"invitees,omitempty"` + LastAccessed datadog.NullableTime `json:"last_accessed,omitempty"` PublicUrl *string `json:"public_url,omitempty"` SelectableTemplateVars []SelectableTemplateVariableItems `json:"selectable_template_vars,omitempty"` ShareList datadog.NullableList[string] `json:"share_list,omitempty"` ShareType NullableDashboardShareType `json:"share_type,omitempty"` + Status *SharedDashboardStatus `json:"status,omitempty"` + Title *string `json:"title,omitempty"` Token *string `json:"token,omitempty"` + ViewingPreferences *ViewingPreferences `json:"viewing_preferences,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -463,7 +727,7 @@ func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"author", "created_at", "dashboard_id", "dashboard_type", "global_time", "global_time_selectable_enabled", "public_url", "selectable_template_vars", "share_list", "share_type", "token"}) + datadog.DeleteKeys(additionalProperties, &[]string{"author", "created", "dashboard_id", "dashboard_type", "embeddable_domains", "expiration", "global_time", "global_time_selectable_enabled", "invitees", "last_accessed", "public_url", "selectable_template_vars", "share_list", "share_type", "status", "title", "token", "viewing_preferences"}) } else { return err } @@ -473,18 +737,22 @@ func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { hasInvalidField = true } o.Author = all.Author - o.CreatedAt = all.CreatedAt + o.Created = all.Created o.DashboardId = *all.DashboardId if !all.DashboardType.IsValid() { hasInvalidField = true } else { o.DashboardType = *all.DashboardType } + o.EmbeddableDomains = all.EmbeddableDomains + o.Expiration = all.Expiration if all.GlobalTime != nil && all.GlobalTime.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } o.GlobalTime = all.GlobalTime o.GlobalTimeSelectableEnabled = all.GlobalTimeSelectableEnabled + o.Invitees = all.Invitees + o.LastAccessed = all.LastAccessed o.PublicUrl = all.PublicUrl o.SelectableTemplateVars = all.SelectableTemplateVars o.ShareList = all.ShareList @@ -493,7 +761,17 @@ func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { } else { o.ShareType = all.ShareType } + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + o.Title = all.Title o.Token = all.Token + if all.ViewingPreferences != nil && all.ViewingPreferences.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ViewingPreferences = all.ViewingPreferences if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_shared_dashboard_invitees_items.go b/api/datadogV1/model_shared_dashboard_invitees_items.go new file mode 100644 index 00000000000..29d69c9db2e --- /dev/null +++ b/api/datadogV1/model_shared_dashboard_invitees_items.go @@ -0,0 +1,187 @@ +// 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 datadogV1 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SharedDashboardInviteesItems The allowlisted invitees for an INVITE-only shared dashboard. +type SharedDashboardInviteesItems struct { + // Time of the invitee expiration. Null means the invite will not expire. + AccessExpiration datadog.NullableTime `json:"access_expiration,omitempty"` + // Time that the invitee was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Email of the invitee. + Email string `json:"email"` + // 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:"-"` +} + +// NewSharedDashboardInviteesItems instantiates a new SharedDashboardInviteesItems 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 NewSharedDashboardInviteesItems(email string) *SharedDashboardInviteesItems { + this := SharedDashboardInviteesItems{} + this.Email = email + return &this +} + +// NewSharedDashboardInviteesItemsWithDefaults instantiates a new SharedDashboardInviteesItems 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 NewSharedDashboardInviteesItemsWithDefaults() *SharedDashboardInviteesItems { + this := SharedDashboardInviteesItems{} + return &this +} + +// GetAccessExpiration returns the AccessExpiration field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SharedDashboardInviteesItems) GetAccessExpiration() time.Time { + if o == nil || o.AccessExpiration.Get() == nil { + var ret time.Time + return ret + } + return *o.AccessExpiration.Get() +} + +// GetAccessExpirationOk returns a tuple with the AccessExpiration 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 *SharedDashboardInviteesItems) GetAccessExpirationOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.AccessExpiration.Get(), o.AccessExpiration.IsSet() +} + +// HasAccessExpiration returns a boolean if a field has been set. +func (o *SharedDashboardInviteesItems) HasAccessExpiration() bool { + return o != nil && o.AccessExpiration.IsSet() +} + +// SetAccessExpiration gets a reference to the given datadog.NullableTime and assigns it to the AccessExpiration field. +func (o *SharedDashboardInviteesItems) SetAccessExpiration(v time.Time) { + o.AccessExpiration.Set(&v) +} + +// SetAccessExpirationNil sets the value for AccessExpiration to be an explicit nil. +func (o *SharedDashboardInviteesItems) SetAccessExpirationNil() { + o.AccessExpiration.Set(nil) +} + +// UnsetAccessExpiration ensures that no value is present for AccessExpiration, not even an explicit nil. +func (o *SharedDashboardInviteesItems) UnsetAccessExpiration() { + o.AccessExpiration.Unset() +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SharedDashboardInviteesItems) 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 *SharedDashboardInviteesItems) 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 *SharedDashboardInviteesItems) 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 *SharedDashboardInviteesItems) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetEmail returns the Email field value. +func (o *SharedDashboardInviteesItems) GetEmail() string { + if o == nil { + var ret string + return ret + } + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *SharedDashboardInviteesItems) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Email, true +} + +// SetEmail sets field value. +func (o *SharedDashboardInviteesItems) SetEmail(v string) { + o.Email = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SharedDashboardInviteesItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AccessExpiration.IsSet() { + toSerialize["access_expiration"] = o.AccessExpiration.Get() + } + 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") + } + } + toSerialize["email"] = o.Email + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SharedDashboardInviteesItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccessExpiration datadog.NullableTime `json:"access_expiration,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Email *string `json:"email"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Email == nil { + return fmt.Errorf("required field email missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"access_expiration", "created_at", "email"}) + } else { + return err + } + o.AccessExpiration = all.AccessExpiration + o.CreatedAt = all.CreatedAt + o.Email = *all.Email + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV1/model_shared_dashboard_status.go b/api/datadogV1/model_shared_dashboard_status.go new file mode 100644 index 00000000000..1c0b14c80dd --- /dev/null +++ b/api/datadogV1/model_shared_dashboard_status.go @@ -0,0 +1,66 @@ +// 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 datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SharedDashboardStatus Active means the dashboard is publicly available. Paused means the dashboard is not publicly available. +type SharedDashboardStatus string + +// List of SharedDashboardStatus. +const ( + SHAREDDASHBOARDSTATUS_ACTIVE SharedDashboardStatus = "active" + SHAREDDASHBOARDSTATUS_PAUSED SharedDashboardStatus = "paused" +) + +var allowedSharedDashboardStatusEnumValues = []SharedDashboardStatus{ + SHAREDDASHBOARDSTATUS_ACTIVE, + SHAREDDASHBOARDSTATUS_PAUSED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SharedDashboardStatus) GetAllowedValues() []SharedDashboardStatus { + return allowedSharedDashboardStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SharedDashboardStatus) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SharedDashboardStatus(value) + return nil +} + +// NewSharedDashboardStatusFromValue returns a pointer to a valid SharedDashboardStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSharedDashboardStatusFromValue(v string) (*SharedDashboardStatus, error) { + ev := SharedDashboardStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SharedDashboardStatus: valid values are %v", v, allowedSharedDashboardStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SharedDashboardStatus) IsValid() bool { + for _, existing := range allowedSharedDashboardStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SharedDashboardStatus value. +func (v SharedDashboardStatus) Ptr() *SharedDashboardStatus { + return &v +} diff --git a/api/datadogV1/model_shared_dashboard_update_request.go b/api/datadogV1/model_shared_dashboard_update_request.go index c712e8a8838..2a9dd64c4ba 100644 --- a/api/datadogV1/model_shared_dashboard_update_request.go +++ b/api/datadogV1/model_shared_dashboard_update_request.go @@ -5,23 +5,36 @@ package datadogV1 import ( - "fmt" + "time" "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // SharedDashboardUpdateRequest Update a shared dashboard's settings. type SharedDashboardUpdateRequest struct { + // The `SharedDashboard` `embeddable_domains`. + EmbeddableDomains []string `json:"embeddable_domains,omitempty"` + // The time when an OPEN shared dashboard becomes publicly unavailable. + Expiration datadog.NullableTime `json:"expiration,omitempty"` // Timeframe setting for the shared dashboard. - GlobalTime NullableSharedDashboardUpdateRequestGlobalTime `json:"global_time"` + GlobalTime NullableSharedDashboardUpdateRequestGlobalTime `json:"global_time,omitempty"` // Whether to allow viewers to select a different global time setting for the shared dashboard. GlobalTimeSelectableEnabled datadog.NullableBool `json:"global_time_selectable_enabled,omitempty"` + // The `SharedDashboard` `invitees`. + Invitees []SharedDashboardInviteesItems `json:"invitees,omitempty"` // List of objects representing template variables on the shared dashboard which can have selectable values. SelectableTemplateVars []SelectableTemplateVariableItems `json:"selectable_template_vars,omitempty"` // List of email addresses that can be given access to the shared dashboard. + // Deprecated ShareList datadog.NullableList[string] `json:"share_list,omitempty"` // Type of sharing access (either open to anyone who has the public URL or invite-only). ShareType NullableDashboardShareType `json:"share_type,omitempty"` + // Active means the dashboard is publicly available. Paused means the dashboard is not publicly available. + Status *SharedDashboardStatus `json:"status,omitempty"` + // Title of the shared dashboard. + Title *string `json:"title,omitempty"` + // The viewing preferences for a shared dashboard. + ViewingPreferences *ViewingPreferences `json:"viewing_preferences,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:"-"` @@ -31,9 +44,8 @@ type SharedDashboardUpdateRequest struct { // 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 NewSharedDashboardUpdateRequest(globalTime NullableSharedDashboardUpdateRequestGlobalTime) *SharedDashboardUpdateRequest { +func NewSharedDashboardUpdateRequest() *SharedDashboardUpdateRequest { this := SharedDashboardUpdateRequest{} - this.GlobalTime = globalTime return &this } @@ -45,8 +57,74 @@ func NewSharedDashboardUpdateRequestWithDefaults() *SharedDashboardUpdateRequest return &this } -// GetGlobalTime returns the GlobalTime field value. -// If the value is explicit nil, the zero value for SharedDashboardUpdateRequestGlobalTime will be returned. +// GetEmbeddableDomains returns the EmbeddableDomains field value if set, zero value otherwise. +func (o *SharedDashboardUpdateRequest) GetEmbeddableDomains() []string { + if o == nil || o.EmbeddableDomains == nil { + var ret []string + return ret + } + return o.EmbeddableDomains +} + +// GetEmbeddableDomainsOk returns a tuple with the EmbeddableDomains field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SharedDashboardUpdateRequest) GetEmbeddableDomainsOk() (*[]string, bool) { + if o == nil || o.EmbeddableDomains == nil { + return nil, false + } + return &o.EmbeddableDomains, true +} + +// HasEmbeddableDomains returns a boolean if a field has been set. +func (o *SharedDashboardUpdateRequest) HasEmbeddableDomains() bool { + return o != nil && o.EmbeddableDomains != nil +} + +// SetEmbeddableDomains gets a reference to the given []string and assigns it to the EmbeddableDomains field. +func (o *SharedDashboardUpdateRequest) SetEmbeddableDomains(v []string) { + o.EmbeddableDomains = v +} + +// GetExpiration returns the Expiration field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SharedDashboardUpdateRequest) GetExpiration() time.Time { + if o == nil || o.Expiration.Get() == nil { + var ret time.Time + return ret + } + return *o.Expiration.Get() +} + +// GetExpirationOk returns a tuple with the Expiration 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 *SharedDashboardUpdateRequest) GetExpirationOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Expiration.Get(), o.Expiration.IsSet() +} + +// HasExpiration returns a boolean if a field has been set. +func (o *SharedDashboardUpdateRequest) HasExpiration() bool { + return o != nil && o.Expiration.IsSet() +} + +// SetExpiration gets a reference to the given datadog.NullableTime and assigns it to the Expiration field. +func (o *SharedDashboardUpdateRequest) SetExpiration(v time.Time) { + o.Expiration.Set(&v) +} + +// SetExpirationNil sets the value for Expiration to be an explicit nil. +func (o *SharedDashboardUpdateRequest) SetExpirationNil() { + o.Expiration.Set(nil) +} + +// UnsetExpiration ensures that no value is present for Expiration, not even an explicit nil. +func (o *SharedDashboardUpdateRequest) UnsetExpiration() { + o.Expiration.Unset() +} + +// GetGlobalTime returns the GlobalTime field value if set, zero value otherwise (both if not set or set to explicit null). func (o *SharedDashboardUpdateRequest) GetGlobalTime() SharedDashboardUpdateRequestGlobalTime { if o == nil || o.GlobalTime.Get() == nil { var ret SharedDashboardUpdateRequestGlobalTime @@ -55,7 +133,7 @@ func (o *SharedDashboardUpdateRequest) GetGlobalTime() SharedDashboardUpdateRequ return *o.GlobalTime.Get() } -// GetGlobalTimeOk returns a tuple with the GlobalTime field value +// GetGlobalTimeOk returns a tuple with the GlobalTime 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 *SharedDashboardUpdateRequest) GetGlobalTimeOk() (*SharedDashboardUpdateRequestGlobalTime, bool) { @@ -65,11 +143,26 @@ func (o *SharedDashboardUpdateRequest) GetGlobalTimeOk() (*SharedDashboardUpdate return o.GlobalTime.Get(), o.GlobalTime.IsSet() } -// SetGlobalTime sets field value. +// HasGlobalTime returns a boolean if a field has been set. +func (o *SharedDashboardUpdateRequest) HasGlobalTime() bool { + return o != nil && o.GlobalTime.IsSet() +} + +// SetGlobalTime gets a reference to the given NullableSharedDashboardUpdateRequestGlobalTime and assigns it to the GlobalTime field. func (o *SharedDashboardUpdateRequest) SetGlobalTime(v SharedDashboardUpdateRequestGlobalTime) { o.GlobalTime.Set(&v) } +// SetGlobalTimeNil sets the value for GlobalTime to be an explicit nil. +func (o *SharedDashboardUpdateRequest) SetGlobalTimeNil() { + o.GlobalTime.Set(nil) +} + +// UnsetGlobalTime ensures that no value is present for GlobalTime, not even an explicit nil. +func (o *SharedDashboardUpdateRequest) UnsetGlobalTime() { + o.GlobalTime.Unset() +} + // GetGlobalTimeSelectableEnabled returns the GlobalTimeSelectableEnabled field value if set, zero value otherwise (both if not set or set to explicit null). func (o *SharedDashboardUpdateRequest) GetGlobalTimeSelectableEnabled() bool { if o == nil || o.GlobalTimeSelectableEnabled.Get() == nil { @@ -109,6 +202,34 @@ func (o *SharedDashboardUpdateRequest) UnsetGlobalTimeSelectableEnabled() { o.GlobalTimeSelectableEnabled.Unset() } +// GetInvitees returns the Invitees field value if set, zero value otherwise. +func (o *SharedDashboardUpdateRequest) GetInvitees() []SharedDashboardInviteesItems { + if o == nil || o.Invitees == nil { + var ret []SharedDashboardInviteesItems + return ret + } + return o.Invitees +} + +// GetInviteesOk returns a tuple with the Invitees field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SharedDashboardUpdateRequest) GetInviteesOk() (*[]SharedDashboardInviteesItems, bool) { + if o == nil || o.Invitees == nil { + return nil, false + } + return &o.Invitees, true +} + +// HasInvitees returns a boolean if a field has been set. +func (o *SharedDashboardUpdateRequest) HasInvitees() bool { + return o != nil && o.Invitees != nil +} + +// SetInvitees gets a reference to the given []SharedDashboardInviteesItems and assigns it to the Invitees field. +func (o *SharedDashboardUpdateRequest) SetInvitees(v []SharedDashboardInviteesItems) { + o.Invitees = v +} + // GetSelectableTemplateVars returns the SelectableTemplateVars field value if set, zero value otherwise (both if not set or set to explicit null). func (o *SharedDashboardUpdateRequest) GetSelectableTemplateVars() []SelectableTemplateVariableItems { if o == nil { @@ -139,6 +260,7 @@ func (o *SharedDashboardUpdateRequest) SetSelectableTemplateVars(v []SelectableT } // GetShareList returns the ShareList field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated func (o *SharedDashboardUpdateRequest) GetShareList() []string { if o == nil || o.ShareList.Get() == nil { var ret []string @@ -150,6 +272,7 @@ func (o *SharedDashboardUpdateRequest) GetShareList() []string { // GetShareListOk returns a tuple with the ShareList 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. +// Deprecated func (o *SharedDashboardUpdateRequest) GetShareListOk() (*[]string, bool) { if o == nil { return nil, false @@ -163,6 +286,7 @@ func (o *SharedDashboardUpdateRequest) HasShareList() bool { } // SetShareList gets a reference to the given datadog.NullableList[string] and assigns it to the ShareList field. +// Deprecated func (o *SharedDashboardUpdateRequest) SetShareList(v []string) { o.ShareList.Set(&v) } @@ -216,16 +340,111 @@ func (o *SharedDashboardUpdateRequest) UnsetShareType() { o.ShareType.Unset() } +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SharedDashboardUpdateRequest) GetStatus() SharedDashboardStatus { + if o == nil || o.Status == nil { + var ret SharedDashboardStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SharedDashboardUpdateRequest) GetStatusOk() (*SharedDashboardStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SharedDashboardUpdateRequest) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given SharedDashboardStatus and assigns it to the Status field. +func (o *SharedDashboardUpdateRequest) SetStatus(v SharedDashboardStatus) { + o.Status = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *SharedDashboardUpdateRequest) 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 *SharedDashboardUpdateRequest) 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 *SharedDashboardUpdateRequest) 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 *SharedDashboardUpdateRequest) SetTitle(v string) { + o.Title = &v +} + +// GetViewingPreferences returns the ViewingPreferences field value if set, zero value otherwise. +func (o *SharedDashboardUpdateRequest) GetViewingPreferences() ViewingPreferences { + if o == nil || o.ViewingPreferences == nil { + var ret ViewingPreferences + return ret + } + return *o.ViewingPreferences +} + +// GetViewingPreferencesOk returns a tuple with the ViewingPreferences field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SharedDashboardUpdateRequest) GetViewingPreferencesOk() (*ViewingPreferences, bool) { + if o == nil || o.ViewingPreferences == nil { + return nil, false + } + return o.ViewingPreferences, true +} + +// HasViewingPreferences returns a boolean if a field has been set. +func (o *SharedDashboardUpdateRequest) HasViewingPreferences() bool { + return o != nil && o.ViewingPreferences != nil +} + +// SetViewingPreferences gets a reference to the given ViewingPreferences and assigns it to the ViewingPreferences field. +func (o *SharedDashboardUpdateRequest) SetViewingPreferences(v ViewingPreferences) { + o.ViewingPreferences = &v +} + // MarshalJSON serializes the struct using spec logic. func (o SharedDashboardUpdateRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - toSerialize["global_time"] = o.GlobalTime.Get() + if o.EmbeddableDomains != nil { + toSerialize["embeddable_domains"] = o.EmbeddableDomains + } + if o.Expiration.IsSet() { + toSerialize["expiration"] = o.Expiration.Get() + } + if o.GlobalTime.IsSet() { + toSerialize["global_time"] = o.GlobalTime.Get() + } if o.GlobalTimeSelectableEnabled.IsSet() { toSerialize["global_time_selectable_enabled"] = o.GlobalTimeSelectableEnabled.Get() } + if o.Invitees != nil { + toSerialize["invitees"] = o.Invitees + } if o.SelectableTemplateVars != nil { toSerialize["selectable_template_vars"] = o.SelectableTemplateVars } @@ -235,6 +454,15 @@ func (o SharedDashboardUpdateRequest) MarshalJSON() ([]byte, error) { if o.ShareType.IsSet() { toSerialize["share_type"] = o.ShareType.Get() } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.ViewingPreferences != nil { + toSerialize["viewing_preferences"] = o.ViewingPreferences + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -245,28 +473,34 @@ func (o SharedDashboardUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { all := struct { - GlobalTime NullableSharedDashboardUpdateRequestGlobalTime `json:"global_time"` + EmbeddableDomains []string `json:"embeddable_domains,omitempty"` + Expiration datadog.NullableTime `json:"expiration,omitempty"` + GlobalTime NullableSharedDashboardUpdateRequestGlobalTime `json:"global_time,omitempty"` GlobalTimeSelectableEnabled datadog.NullableBool `json:"global_time_selectable_enabled,omitempty"` + Invitees []SharedDashboardInviteesItems `json:"invitees,omitempty"` SelectableTemplateVars []SelectableTemplateVariableItems `json:"selectable_template_vars,omitempty"` ShareList datadog.NullableList[string] `json:"share_list,omitempty"` ShareType NullableDashboardShareType `json:"share_type,omitempty"` + Status *SharedDashboardStatus `json:"status,omitempty"` + Title *string `json:"title,omitempty"` + ViewingPreferences *ViewingPreferences `json:"viewing_preferences,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } - if !all.GlobalTime.IsSet() { - return fmt.Errorf("required field global_time missing") - } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"global_time", "global_time_selectable_enabled", "selectable_template_vars", "share_list", "share_type"}) + datadog.DeleteKeys(additionalProperties, &[]string{"embeddable_domains", "expiration", "global_time", "global_time_selectable_enabled", "invitees", "selectable_template_vars", "share_list", "share_type", "status", "title", "viewing_preferences"}) } else { return err } hasInvalidField := false + o.EmbeddableDomains = all.EmbeddableDomains + o.Expiration = all.Expiration o.GlobalTime = all.GlobalTime o.GlobalTimeSelectableEnabled = all.GlobalTimeSelectableEnabled + o.Invitees = all.Invitees o.SelectableTemplateVars = all.SelectableTemplateVars o.ShareList = all.ShareList if all.ShareType.Get() != nil && !all.ShareType.Get().IsValid() { @@ -274,6 +508,16 @@ func (o *SharedDashboardUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } else { o.ShareType = all.ShareType } + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + o.Title = all.Title + if all.ViewingPreferences != nil && all.ViewingPreferences.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ViewingPreferences = all.ViewingPreferences if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_viewing_preferences.go b/api/datadogV1/model_viewing_preferences.go new file mode 100644 index 00000000000..ae7426b8e08 --- /dev/null +++ b/api/datadogV1/model_viewing_preferences.go @@ -0,0 +1,147 @@ +// 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 datadogV1 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ViewingPreferences The viewing preferences for a shared dashboard. +type ViewingPreferences struct { + // Whether the widgets on the shared dashboard should be displayed with high density. + HighDensity *bool `json:"high_density,omitempty"` + // The theme of the shared dashboard view. "system" follows your system's default viewing theme. + Theme *ViewingPreferencesTheme `json:"theme,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:"-"` +} + +// NewViewingPreferences instantiates a new ViewingPreferences 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 NewViewingPreferences() *ViewingPreferences { + this := ViewingPreferences{} + return &this +} + +// NewViewingPreferencesWithDefaults instantiates a new ViewingPreferences 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 NewViewingPreferencesWithDefaults() *ViewingPreferences { + this := ViewingPreferences{} + return &this +} + +// GetHighDensity returns the HighDensity field value if set, zero value otherwise. +func (o *ViewingPreferences) GetHighDensity() bool { + if o == nil || o.HighDensity == nil { + var ret bool + return ret + } + return *o.HighDensity +} + +// GetHighDensityOk returns a tuple with the HighDensity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ViewingPreferences) GetHighDensityOk() (*bool, bool) { + if o == nil || o.HighDensity == nil { + return nil, false + } + return o.HighDensity, true +} + +// HasHighDensity returns a boolean if a field has been set. +func (o *ViewingPreferences) HasHighDensity() bool { + return o != nil && o.HighDensity != nil +} + +// SetHighDensity gets a reference to the given bool and assigns it to the HighDensity field. +func (o *ViewingPreferences) SetHighDensity(v bool) { + o.HighDensity = &v +} + +// GetTheme returns the Theme field value if set, zero value otherwise. +func (o *ViewingPreferences) GetTheme() ViewingPreferencesTheme { + if o == nil || o.Theme == nil { + var ret ViewingPreferencesTheme + return ret + } + return *o.Theme +} + +// GetThemeOk returns a tuple with the Theme field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ViewingPreferences) GetThemeOk() (*ViewingPreferencesTheme, bool) { + if o == nil || o.Theme == nil { + return nil, false + } + return o.Theme, true +} + +// HasTheme returns a boolean if a field has been set. +func (o *ViewingPreferences) HasTheme() bool { + return o != nil && o.Theme != nil +} + +// SetTheme gets a reference to the given ViewingPreferencesTheme and assigns it to the Theme field. +func (o *ViewingPreferences) SetTheme(v ViewingPreferencesTheme) { + o.Theme = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ViewingPreferences) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.HighDensity != nil { + toSerialize["high_density"] = o.HighDensity + } + if o.Theme != nil { + toSerialize["theme"] = o.Theme + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ViewingPreferences) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + HighDensity *bool `json:"high_density,omitempty"` + Theme *ViewingPreferencesTheme `json:"theme,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{"high_density", "theme"}) + } else { + return err + } + + hasInvalidField := false + o.HighDensity = all.HighDensity + if all.Theme != nil && !all.Theme.IsValid() { + hasInvalidField = true + } else { + o.Theme = all.Theme + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV1/model_viewing_preferences_theme.go b/api/datadogV1/model_viewing_preferences_theme.go new file mode 100644 index 00000000000..af0c0f29cfb --- /dev/null +++ b/api/datadogV1/model_viewing_preferences_theme.go @@ -0,0 +1,68 @@ +// 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 datadogV1 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ViewingPreferencesTheme The theme of the shared dashboard view. "system" follows your system's default viewing theme. +type ViewingPreferencesTheme string + +// List of ViewingPreferencesTheme. +const ( + VIEWINGPREFERENCESTHEME_SYSTEM ViewingPreferencesTheme = "system" + VIEWINGPREFERENCESTHEME_LIGHT ViewingPreferencesTheme = "light" + VIEWINGPREFERENCESTHEME_DARK ViewingPreferencesTheme = "dark" +) + +var allowedViewingPreferencesThemeEnumValues = []ViewingPreferencesTheme{ + VIEWINGPREFERENCESTHEME_SYSTEM, + VIEWINGPREFERENCESTHEME_LIGHT, + VIEWINGPREFERENCESTHEME_DARK, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *ViewingPreferencesTheme) GetAllowedValues() []ViewingPreferencesTheme { + return allowedViewingPreferencesThemeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *ViewingPreferencesTheme) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = ViewingPreferencesTheme(value) + return nil +} + +// NewViewingPreferencesThemeFromValue returns a pointer to a valid ViewingPreferencesTheme +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewViewingPreferencesThemeFromValue(v string) (*ViewingPreferencesTheme, error) { + ev := ViewingPreferencesTheme(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for ViewingPreferencesTheme: valid values are %v", v, allowedViewingPreferencesThemeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v ViewingPreferencesTheme) IsValid() bool { + for _, existing := range allowedViewingPreferencesThemeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ViewingPreferencesTheme value. +func (v ViewingPreferencesTheme) Ptr() *ViewingPreferencesTheme { + return &v +} diff --git a/tests/scenarios/features/v1/dashboards.feature b/tests/scenarios/features/v1/dashboards.feature index fbc89cc98ce..45b0ea0d3ab 100644 --- a/tests/scenarios/features/v1/dashboards.feature +++ b/tests/scenarios/features/v1/dashboards.feature @@ -936,21 +936,21 @@ Feature: Dashboards And the response "widgets[0].definition.time.unit" is equal to "minute" And the response "widgets[0].definition.time.value" is equal to 8 - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Create a shared dashboard returns "Bad Request" response Given new "CreatePublicDashboard" request - And body with value {"dashboard_id": "123-abc-456", "dashboard_type": "custom_timeboard", "global_time": {"live_span": "1h"}, "global_time_selectable_enabled": null, "selectable_template_vars": [{"default_value": "*", "name": "exampleVar", "prefix": "test", "visible_tags": ["selectableValue1", "selectableValue2"]}], "share_list": ["test@datadoghq.com", "test2@email.com"], "share_type": "open"} + And body with value {"dashboard_id": "123-abc-456", "dashboard_type": "custom_timeboard", "embeddable_domains": ["https://domain.atlassian.net/", "http://myserver.com/"], "expiration": null, "global_time": {"live_span": "1h"}, "global_time_selectable_enabled": null, "invitees": [{"access_expiration": "2030-01-01T12:00:00.00Z", "email": "test@datadoghq.com"}, {"access_expiration": null, "email": "test2@datadoghq.com"}], "selectable_template_vars": [{"default_value": "*", "name": "exampleVar", "prefix": "test", "visible_tags": ["selectableValue1", "selectableValue2"]}], "share_list": ["test@datadoghq.com", "test2@email.com"], "share_type": "open", "status": "active", "viewing_preferences": {"theme": "system"}} When the request is sent Then the response status is 400 Bad Request - @team:DataDog/dashboards-backend + @team:DataDog/reporting-and-sharing Scenario: Create a shared dashboard returns "Dashboard Not Found" response Given new "CreatePublicDashboard" request And body with value {"dashboard_id": "abc-123-def", "dashboard_type": "custom_timeboard", "share_type": "open", "global_time": {"live_span": "1h"}} When the request is sent Then the response status is 404 Dashboard Not Found - @team:DataDog/dashboards-backend + @team:DataDog/reporting-and-sharing Scenario: Create a shared dashboard returns "OK" response Given there is a valid "dashboard" in the system And new "CreatePublicDashboard" request @@ -1023,7 +1023,7 @@ Feature: Dashboards Then the response status is 200 OK And the response "author_name" is equal to "Frog Account" - @team:DataDog/dashboards-backend + @team:DataDog/reporting-and-sharing Scenario: Get a shared dashboard returns "OK" response Given there is a valid "dashboard" in the system And there is a valid "shared_dashboard" in the system @@ -1034,7 +1034,7 @@ Feature: Dashboards And the response "dashboard_id" has the same value as "dashboard.id" And the response "token" has the same value as "shared_dashboard.token" - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Get a shared dashboard returns "Shared Dashboard Not Found" response Given new "GetPublicDashboard" request And request contains "token" parameter from "REPLACE.ME" @@ -1059,14 +1059,14 @@ Feature: Dashboards Then the response status is 200 OK And the response has 3 items - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Get all invitations for a shared dashboard returns "Not Found" response Given new "GetPublicDashboardInvitations" request And request contains "token" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @team:DataDog/dashboards-backend + @team:DataDog/reporting-and-sharing Scenario: Get all invitations for a shared dashboard returns "OK" response Given there is a valid "dashboard" in the system And there is a valid "shared_dashboard" in the system @@ -1110,21 +1110,21 @@ Feature: Dashboards When the request is sent Then the response status is 204 No Content - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Revoke a shared dashboard URL returns "OK" response Given new "DeletePublicDashboard" request And request contains "token" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Revoke a shared dashboard URL returns "Shared Dashboard Not Found" response Given new "DeletePublicDashboard" request And request contains "token" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Shared Dashboard Not Found - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Revoke shared dashboard invitations returns "Not Found" response Given new "DeletePublicDashboardInvitation" request And request contains "token" parameter from "REPLACE.ME" @@ -1132,7 +1132,7 @@ Feature: Dashboards When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Revoke shared dashboard invitations returns "OK" response Given new "DeletePublicDashboardInvitation" request And request contains "token" parameter from "REPLACE.ME" @@ -1140,7 +1140,7 @@ Feature: Dashboards When the request is sent Then the response status is 204 OK - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Send shared dashboard invitation email returns "Bad Request" response Given new "SendPublicDashboardInvitation" request And request contains "token" parameter from "REPLACE.ME" @@ -1148,7 +1148,7 @@ Feature: Dashboards When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Send shared dashboard invitation email returns "Not Found" response Given new "SendPublicDashboardInvitation" request And request contains "token" parameter from "REPLACE.ME" @@ -1156,7 +1156,7 @@ Feature: Dashboards When the request is sent Then the response status is 404 Not Found - @team:DataDog/dashboards-backend + @team:DataDog/reporting-and-sharing Scenario: Send shared dashboard invitation email returns "OK" response Given there is a valid "dashboard" in the system And there is a valid "shared_dashboard" in the system @@ -1204,7 +1204,7 @@ Feature: Dashboards Then the response status is 200 OK And the response "tags" is equal to ["team:foo", "team:bar"] - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Update a shared dashboard returns "Bad Request" response Given new "UpdatePublicDashboard" request And request contains "token" parameter from "REPLACE.ME" @@ -1212,7 +1212,7 @@ Feature: Dashboards When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/dashboards-backend + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Update a shared dashboard returns "Item Not Found" response Given new "UpdatePublicDashboard" request And request contains "token" parameter from "REPLACE.ME" @@ -1220,7 +1220,7 @@ Feature: Dashboards When the request is sent Then the response status is 404 Item Not Found - @team:DataDog/dashboards-backend + @team:DataDog/reporting-and-sharing Scenario: Update a shared dashboard returns "OK" response Given there is a valid "dashboard" in the system And there is a valid "shared_dashboard" in the system