Skip to content

Commit 44b1ec2

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 6cba7b1 of spec repo
1 parent 6be4c93 commit 44b1ec2

13 files changed

+653
-13
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7255,6 +7255,12 @@ components:
72557255
Monitor:
72567256
description: Object describing a monitor.
72577257
properties:
7258+
assets:
7259+
description: The list of monitor assets tied to a monitor, which represents
7260+
key links for users to take action on monitor alerts (for example, runbooks).
7261+
items:
7262+
$ref: '#/components/schemas/MonitorAsset'
7263+
type: array
72587264
created:
72597265
description: Timestamp of the monitor creation.
72607266
format: date-time
@@ -7338,6 +7344,52 @@ components:
73387344
- type
73397345
- query
73407346
type: object
7347+
MonitorAsset:
7348+
description: 'Represents key links tied to a monitor to help users take action
7349+
on alerts.
7350+
7351+
This feature is in Preview and only available to users with the feature enabled.'
7352+
properties:
7353+
category:
7354+
$ref: '#/components/schemas/MonitorAssetCategory'
7355+
name:
7356+
description: Name for the monitor asset
7357+
example: Monitor Runbook
7358+
type: string
7359+
resource_key:
7360+
description: Represents the identifier of the internal Datadog resource
7361+
that this asset represents. IDs in this field should be passed in as strings.
7362+
example: '12345'
7363+
type: string
7364+
resource_type:
7365+
$ref: '#/components/schemas/MonitorAssetResourceType'
7366+
url:
7367+
description: URL link for the asset. For links with an internal resource
7368+
type set, this should be the relative path to where the Datadog domain
7369+
is appended internally. For external links, this should be the full URL
7370+
path.
7371+
example: /notebooks/12345
7372+
type: string
7373+
required:
7374+
- name
7375+
- url
7376+
- category
7377+
type: object
7378+
MonitorAssetCategory:
7379+
description: Indicates the type of asset this entity represents on a monitor.
7380+
enum:
7381+
- runbook
7382+
example: runbook
7383+
type: string
7384+
x-enum-varnames:
7385+
- RUNBOOK
7386+
MonitorAssetResourceType:
7387+
description: Type of internal Datadog resource associated with a monitor asset.
7388+
enum:
7389+
- notebook
7390+
type: string
7391+
x-enum-varnames:
7392+
- NOTEBOOK
73417393
MonitorDeviceID:
73427394
description: ID of the device the Synthetics monitor is running on. Same as
73437395
`SyntheticsDeviceID`.
@@ -8452,6 +8504,13 @@ components:
84528504
MonitorUpdateRequest:
84538505
description: Object describing a monitor update request.
84548506
properties:
8507+
assets:
8508+
description: The list of monitor assets tied to a monitor, which represents
8509+
key links for users to take action on monitor alerts (for example, runbooks).
8510+
items:
8511+
$ref: '#/components/schemas/MonitorAsset'
8512+
nullable: true
8513+
type: array
84558514
created:
84568515
description: Timestamp of the monitor creation.
84578516
format: date-time
@@ -31584,6 +31643,13 @@ paths:
3158431643
required: false
3158531644
schema:
3158631645
type: boolean
31646+
- description: If this argument is set to `true`, the returned data includes
31647+
all assets tied to this monitor.
31648+
in: query
31649+
name: with_assets
31650+
required: false
31651+
schema:
31652+
type: boolean
3158731653
responses:
3158831654
'200':
3158931655
content:

api/datadogV1/api_monitors.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ func (a *MonitorsApi) DeleteMonitor(ctx _context.Context, monitorId int64, o ...
512512
type GetMonitorOptionalParameters struct {
513513
GroupStates *string
514514
WithDowntimes *bool
515+
WithAssets *bool
515516
}
516517

517518
// NewGetMonitorOptionalParameters creates an empty struct for parameters.
@@ -532,6 +533,12 @@ func (r *GetMonitorOptionalParameters) WithWithDowntimes(withDowntimes bool) *Ge
532533
return r
533534
}
534535

536+
// WithWithAssets sets the corresponding parameter name and returns the struct.
537+
func (r *GetMonitorOptionalParameters) WithWithAssets(withAssets bool) *GetMonitorOptionalParameters {
538+
r.WithAssets = &withAssets
539+
return r
540+
}
541+
535542
// GetMonitor Get a monitor's details.
536543
// Get details about the specified monitor from your organization.
537544
func (a *MonitorsApi) GetMonitor(ctx _context.Context, monitorId int64, o ...GetMonitorOptionalParameters) (Monitor, *_nethttp.Response, error) {
@@ -566,6 +573,9 @@ func (a *MonitorsApi) GetMonitor(ctx _context.Context, monitorId int64, o ...Get
566573
if optionalParams.WithDowntimes != nil {
567574
localVarQueryParams.Add("with_downtimes", datadog.ParameterToString(*optionalParams.WithDowntimes, ""))
568575
}
576+
if optionalParams.WithAssets != nil {
577+
localVarQueryParams.Add("with_assets", datadog.ParameterToString(*optionalParams.WithAssets, ""))
578+
}
569579
localVarHeaderParams["Accept"] = "application/json"
570580

571581
if a.Client.Cfg.DelegatedTokenConfig != nil {

api/datadogV1/model_monitor.go

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313

1414
// Monitor Object describing a monitor.
1515
type Monitor struct {
16+
// The list of monitor assets tied to a monitor, which represents key links for users to take action on monitor alerts (for example, runbooks).
17+
Assets []MonitorAsset `json:"assets,omitempty"`
1618
// Timestamp of the monitor creation.
1719
Created *time.Time `json:"created,omitempty"`
1820
// Object describing the creator of the shared element.
@@ -82,6 +84,34 @@ func NewMonitorWithDefaults() *Monitor {
8284
return &this
8385
}
8486

87+
// GetAssets returns the Assets field value if set, zero value otherwise.
88+
func (o *Monitor) GetAssets() []MonitorAsset {
89+
if o == nil || o.Assets == nil {
90+
var ret []MonitorAsset
91+
return ret
92+
}
93+
return o.Assets
94+
}
95+
96+
// GetAssetsOk returns a tuple with the Assets field value if set, nil otherwise
97+
// and a boolean to check if the value has been set.
98+
func (o *Monitor) GetAssetsOk() (*[]MonitorAsset, bool) {
99+
if o == nil || o.Assets == nil {
100+
return nil, false
101+
}
102+
return &o.Assets, true
103+
}
104+
105+
// HasAssets returns a boolean if a field has been set.
106+
func (o *Monitor) HasAssets() bool {
107+
return o != nil && o.Assets != nil
108+
}
109+
110+
// SetAssets gets a reference to the given []MonitorAsset and assigns it to the Assets field.
111+
func (o *Monitor) SetAssets(v []MonitorAsset) {
112+
o.Assets = v
113+
}
114+
85115
// GetCreated returns the Created field value if set, zero value otherwise.
86116
func (o *Monitor) GetCreated() time.Time {
87117
if o == nil || o.Created == nil {
@@ -615,6 +645,9 @@ func (o Monitor) MarshalJSON() ([]byte, error) {
615645
if o.UnparsedObject != nil {
616646
return datadog.Marshal(o.UnparsedObject)
617647
}
648+
if o.Assets != nil {
649+
toSerialize["assets"] = o.Assets
650+
}
618651
if o.Created != nil {
619652
if o.Created.Nanosecond() == 0 {
620653
toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00")
@@ -683,6 +716,7 @@ func (o Monitor) MarshalJSON() ([]byte, error) {
683716
// UnmarshalJSON deserializes the given payload.
684717
func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) {
685718
all := struct {
719+
Assets []MonitorAsset `json:"assets,omitempty"`
686720
Created *time.Time `json:"created,omitempty"`
687721
Creator *Creator `json:"creator,omitempty"`
688722
Deleted datadog.NullableTime `json:"deleted,omitempty"`
@@ -713,12 +747,13 @@ func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) {
713747
}
714748
additionalProperties := make(map[string]interface{})
715749
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
716-
datadog.DeleteKeys(additionalProperties, &[]string{"created", "creator", "deleted", "draft_status", "id", "matching_downtimes", "message", "modified", "multi", "name", "options", "overall_state", "priority", "query", "restricted_roles", "state", "tags", "type"})
750+
datadog.DeleteKeys(additionalProperties, &[]string{"assets", "created", "creator", "deleted", "draft_status", "id", "matching_downtimes", "message", "modified", "multi", "name", "options", "overall_state", "priority", "query", "restricted_roles", "state", "tags", "type"})
717751
} else {
718752
return err
719753
}
720754

721755
hasInvalidField := false
756+
o.Assets = all.Assets
722757
o.Created = all.Created
723758
if all.Creator != nil && all.Creator.UnparsedObject != nil && o.UnparsedObject == nil {
724759
hasInvalidField = true

0 commit comments

Comments
 (0)