Skip to content

Commit

Permalink
add url attribute to metrics assets v2 api (#2644)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec committed Aug 21, 2024
1 parent 043ca0a commit 43112e9
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-08-21 15:16:51.126809",
"spec_repo_commit": "4470dfc1"
"regenerated": "2024-08-21 16:52:38.047558",
"spec_repo_commit": "ffed3856"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-08-21 15:16:51.153047",
"spec_repo_commit": "4470dfc1"
"regenerated": "2024-08-21 16:52:38.072264",
"spec_repo_commit": "ffed3856"
}
}
}
11 changes: 9 additions & 2 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12649,11 +12649,14 @@ components:
readOnly: true
type: object
MetricAssetAttributes:
description: Assets where only included attribute is its title
description: Assets related to the object, including title and url.
properties:
title:
description: Title of the asset.
type: string
url:
description: URL path of the asset.
type: string
type: object
MetricAssetDashboardRelationship:
description: An object of type `dashboard` that can be referenced in the `included`
Expand Down Expand Up @@ -13033,7 +13036,8 @@ components:
- type
type: object
MetricDashboardAttributes:
description: Attributes related to the dashboard, including title and popularity.
description: Attributes related to the dashboard, including title, popularity,
and url.
properties:
popularity:
description: Value from 0 to 5 that ranks popularity of the dashboard.
Expand All @@ -13044,6 +13048,9 @@ components:
title:
description: Title of the asset.
type: string
url:
description: URL path of the asset.
type: string
type: object
MetricDashboardID:
description: The related dashboard's ID.
Expand Down
39 changes: 37 additions & 2 deletions api/datadogV2/model_metric_asset_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// MetricAssetAttributes Assets where only included attribute is its title
// MetricAssetAttributes Assets related to the object, including title and url.
type MetricAssetAttributes struct {
// Title of the asset.
Title *string `json:"title,omitempty"`
// URL path of the asset.
Url *string `json:"url,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:"-"`
Expand Down Expand Up @@ -62,6 +64,34 @@ func (o *MetricAssetAttributes) SetTitle(v string) {
o.Title = &v
}

// GetUrl returns the Url field value if set, zero value otherwise.
func (o *MetricAssetAttributes) GetUrl() string {
if o == nil || o.Url == nil {
var ret string
return ret
}
return *o.Url
}

// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MetricAssetAttributes) GetUrlOk() (*string, bool) {
if o == nil || o.Url == nil {
return nil, false
}
return o.Url, true
}

// HasUrl returns a boolean if a field has been set.
func (o *MetricAssetAttributes) HasUrl() bool {
return o != nil && o.Url != nil
}

// SetUrl gets a reference to the given string and assigns it to the Url field.
func (o *MetricAssetAttributes) SetUrl(v string) {
o.Url = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o MetricAssetAttributes) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
Expand All @@ -71,6 +101,9 @@ func (o MetricAssetAttributes) MarshalJSON() ([]byte, error) {
if o.Title != nil {
toSerialize["title"] = o.Title
}
if o.Url != nil {
toSerialize["url"] = o.Url
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
Expand All @@ -82,17 +115,19 @@ func (o MetricAssetAttributes) MarshalJSON() ([]byte, error) {
func (o *MetricAssetAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Title *string `json:"title,omitempty"`
Url *string `json:"url,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{"title"})
datadog.DeleteKeys(additionalProperties, &[]string{"title", "url"})
} else {
return err
}
o.Title = all.Title
o.Url = all.Url

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_metric_dashboard_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// MetricDashboardAsset A dashboard object with title and popularity.
type MetricDashboardAsset struct {
// Attributes related to the dashboard, including title and popularity.
// Attributes related to the dashboard, including title, popularity, and url.
Attributes *MetricDashboardAttributes `json:"attributes,omitempty"`
// The related dashboard's ID.
Id string `json:"id"`
Expand Down
39 changes: 37 additions & 2 deletions api/datadogV2/model_metric_dashboard_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// MetricDashboardAttributes Attributes related to the dashboard, including title and popularity.
// MetricDashboardAttributes Attributes related to the dashboard, including title, popularity, and url.
type MetricDashboardAttributes struct {
// Value from 0 to 5 that ranks popularity of the dashboard.
Popularity *float64 `json:"popularity,omitempty"`
// Title of the asset.
Title *string `json:"title,omitempty"`
// URL path of the asset.
Url *string `json:"url,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:"-"`
Expand Down Expand Up @@ -92,6 +94,34 @@ func (o *MetricDashboardAttributes) SetTitle(v string) {
o.Title = &v
}

// GetUrl returns the Url field value if set, zero value otherwise.
func (o *MetricDashboardAttributes) GetUrl() string {
if o == nil || o.Url == nil {
var ret string
return ret
}
return *o.Url
}

// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MetricDashboardAttributes) GetUrlOk() (*string, bool) {
if o == nil || o.Url == nil {
return nil, false
}
return o.Url, true
}

// HasUrl returns a boolean if a field has been set.
func (o *MetricDashboardAttributes) HasUrl() bool {
return o != nil && o.Url != nil
}

// SetUrl gets a reference to the given string and assigns it to the Url field.
func (o *MetricDashboardAttributes) SetUrl(v string) {
o.Url = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o MetricDashboardAttributes) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
Expand All @@ -104,6 +134,9 @@ func (o MetricDashboardAttributes) MarshalJSON() ([]byte, error) {
if o.Title != nil {
toSerialize["title"] = o.Title
}
if o.Url != nil {
toSerialize["url"] = o.Url
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
Expand All @@ -116,18 +149,20 @@ func (o *MetricDashboardAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Popularity *float64 `json:"popularity,omitempty"`
Title *string `json:"title,omitempty"`
Url *string `json:"url,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{"popularity", "title"})
datadog.DeleteKeys(additionalProperties, &[]string{"popularity", "title", "url"})
} else {
return err
}
o.Popularity = all.Popularity
o.Title = all.Title
o.Url = all.Url

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_metric_monitor_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// MetricMonitorAsset A monitor object with title.
type MetricMonitorAsset struct {
// Assets where only included attribute is its title
// Assets related to the object, including title and url.
Attributes *MetricAssetAttributes `json:"attributes,omitempty"`
// The related monitor's ID.
Id string `json:"id"`
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_metric_notebook_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// MetricNotebookAsset A notebook object with title.
type MetricNotebookAsset struct {
// Assets where only included attribute is its title
// Assets related to the object, including title and url.
Attributes *MetricAssetAttributes `json:"attributes,omitempty"`
// The related notebook's ID.
Id string `json:"id"`
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV2/model_metric_slo_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// MetricSLOAsset A SLO object with title.
type MetricSLOAsset struct {
// Assets where only included attribute is its title
// Assets related to the object, including title and url.
Attributes *MetricAssetAttributes `json:"attributes,omitempty"`
// The SLO ID.
Id string `json:"id"`
Expand Down

0 comments on commit 43112e9

Please sign in to comment.