Skip to content

Commit

Permalink
Regenerate client from commit 7d7fc2d2 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed May 22, 2023
1 parent b16a2b9 commit 4fdb91b
Show file tree
Hide file tree
Showing 9 changed files with 364 additions and 35 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.4",
"regenerated": "2023-05-19 19:02:10.634494",
"spec_repo_commit": "c3f9f308"
"regenerated": "2023-05-22 17:05:22.168677",
"spec_repo_commit": "7d7fc2d2"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-05-19 19:02:10.647487",
"spec_repo_commit": "c3f9f308"
"regenerated": "2023-05-22 17:05:22.181017",
"spec_repo_commit": "7d7fc2d2"
}
}
}
49 changes: 49 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5832,6 +5832,43 @@ components:
type: string
x-enum-varnames:
- USER_AGENT_PARSER
MatchingDowntime:
description: Object describing a downtime that matches this monitor.
properties:
end:
description: POSIX timestamp to end the downtime.
example: 1412792983
format: int64
nullable: true
type: integer
id:
description: The downtime ID.
example: 1625
format: int64
readOnly: true
type: integer
scope:
description: 'The scope(s) to which the downtime applies and must be in
`key:value` format. For example, `host:app2`.

Provide multiple scopes as a comma-separated list like `env:dev,env:prod`.

The resulting downtime applies to sources that matches ALL provided scopes
(`env:dev` **AND** `env:prod`).'
example:
- env:staging
items:
description: A scope. For example, `"env:staging"`.
type: string
type: array
start:
description: POSIX timestamp to start the downtime.
example: 1412792983
format: int64
type: integer
required:
- id
type: object
MetricContentEncoding:
default: deflate
description: HTTP header used to compress the media-type.
Expand Down Expand Up @@ -6112,6 +6149,11 @@ components:
format: int64
readOnly: true
type: integer
matching_downtimes:
description: A list of active downtimes that matches this monitor.
items:
$ref: '#/components/schemas/MatchingDowntime'
type: array
message:
description: A message to include with notifications for this monitor.
type: string
Expand Down Expand Up @@ -25357,6 +25399,13 @@ paths:
required: false
schema:
type: string
- description: If this argument is set to true, then the returned data includes
all current active downtimes for the monitor.
in: query
name: with_downtimes
required: false
schema:
type: boolean
responses:
'200':
content:
Expand Down
12 changes: 11 additions & 1 deletion api/datadogV1/api_monitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ func (a *MonitorsApi) DeleteMonitor(ctx _context.Context, monitorId int64, o ...

// GetMonitorOptionalParameters holds optional parameters for GetMonitor.
type GetMonitorOptionalParameters struct {
GroupStates *string
GroupStates *string
WithDowntimes *bool
}

// NewGetMonitorOptionalParameters creates an empty struct for parameters.
Expand All @@ -469,6 +470,12 @@ func (r *GetMonitorOptionalParameters) WithGroupStates(groupStates string) *GetM
return r
}

// WithWithDowntimes sets the corresponding parameter name and returns the struct.
func (r *GetMonitorOptionalParameters) WithWithDowntimes(withDowntimes bool) *GetMonitorOptionalParameters {
r.WithDowntimes = &withDowntimes
return r
}

// GetMonitor Get a monitor's details.
// Get details about the specified monitor from your organization.
func (a *MonitorsApi) GetMonitor(ctx _context.Context, monitorId int64, o ...GetMonitorOptionalParameters) (Monitor, *_nethttp.Response, error) {
Expand Down Expand Up @@ -500,6 +507,9 @@ func (a *MonitorsApi) GetMonitor(ctx _context.Context, monitorId int64, o ...Get
if optionalParams.GroupStates != nil {
localVarQueryParams.Add("group_states", datadog.ParameterToString(*optionalParams.GroupStates, ""))
}
if optionalParams.WithDowntimes != nil {
localVarQueryParams.Add("with_downtimes", datadog.ParameterToString(*optionalParams.WithDowntimes, ""))
}
localVarHeaderParams["Accept"] = "application/json"

datadog.SetAuthKeys(
Expand Down
233 changes: 233 additions & 0 deletions api/datadogV1/model_matching_downtime.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
// 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 (
"encoding/json"
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// MatchingDowntime Object describing a downtime that matches this monitor.
type MatchingDowntime struct {
// POSIX timestamp to end the downtime.
End datadog.NullableInt64 `json:"end,omitempty"`
// The downtime ID.
Id int64 `json:"id"`
// The scope(s) to which the downtime applies and must be in `key:value` format. For example, `host:app2`.
// Provide multiple scopes as a comma-separated list like `env:dev,env:prod`.
// The resulting downtime applies to sources that matches ALL provided scopes (`env:dev` **AND** `env:prod`).
Scope []string `json:"scope,omitempty"`
// POSIX timestamp to start the downtime.
Start *int64 `json:"start,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{}
}

// NewMatchingDowntime instantiates a new MatchingDowntime 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 NewMatchingDowntime(id int64) *MatchingDowntime {
this := MatchingDowntime{}
this.Id = id
return &this
}

// NewMatchingDowntimeWithDefaults instantiates a new MatchingDowntime 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 NewMatchingDowntimeWithDefaults() *MatchingDowntime {
this := MatchingDowntime{}
return &this
}

// GetEnd returns the End field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *MatchingDowntime) GetEnd() int64 {
if o == nil || o.End.Get() == nil {
var ret int64
return ret
}
return *o.End.Get()
}

// GetEndOk returns a tuple with the End 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 *MatchingDowntime) GetEndOk() (*int64, bool) {
if o == nil {
return nil, false
}
return o.End.Get(), o.End.IsSet()
}

// HasEnd returns a boolean if a field has been set.
func (o *MatchingDowntime) HasEnd() bool {
return o != nil && o.End.IsSet()
}

// SetEnd gets a reference to the given datadog.NullableInt64 and assigns it to the End field.
func (o *MatchingDowntime) SetEnd(v int64) {
o.End.Set(&v)
}

// SetEndNil sets the value for End to be an explicit nil.
func (o *MatchingDowntime) SetEndNil() {
o.End.Set(nil)
}

// UnsetEnd ensures that no value is present for End, not even an explicit nil.
func (o *MatchingDowntime) UnsetEnd() {
o.End.Unset()
}

// GetId returns the Id field value.
func (o *MatchingDowntime) GetId() int64 {
if o == nil {
var ret int64
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 *MatchingDowntime) GetIdOk() (*int64, bool) {
if o == nil {
return nil, false
}
return &o.Id, true
}

// SetId sets field value.
func (o *MatchingDowntime) SetId(v int64) {
o.Id = v
}

// GetScope returns the Scope field value if set, zero value otherwise.
func (o *MatchingDowntime) GetScope() []string {
if o == nil || o.Scope == nil {
var ret []string
return ret
}
return o.Scope
}

// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MatchingDowntime) GetScopeOk() (*[]string, bool) {
if o == nil || o.Scope == nil {
return nil, false
}
return &o.Scope, true
}

// HasScope returns a boolean if a field has been set.
func (o *MatchingDowntime) HasScope() bool {
return o != nil && o.Scope != nil
}

// SetScope gets a reference to the given []string and assigns it to the Scope field.
func (o *MatchingDowntime) SetScope(v []string) {
o.Scope = v
}

// GetStart returns the Start field value if set, zero value otherwise.
func (o *MatchingDowntime) GetStart() int64 {
if o == nil || o.Start == nil {
var ret int64
return ret
}
return *o.Start
}

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

// HasStart returns a boolean if a field has been set.
func (o *MatchingDowntime) HasStart() bool {
return o != nil && o.Start != nil
}

// SetStart gets a reference to the given int64 and assigns it to the Start field.
func (o *MatchingDowntime) SetStart(v int64) {
o.Start = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o MatchingDowntime) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return json.Marshal(o.UnparsedObject)
}
if o.End.IsSet() {
toSerialize["end"] = o.End.Get()
}
toSerialize["id"] = o.Id
if o.Scope != nil {
toSerialize["scope"] = o.Scope
}
if o.Start != nil {
toSerialize["start"] = o.Start
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return json.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *MatchingDowntime) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
required := struct {
Id *int64 `json:"id"`
}{}
all := struct {
End datadog.NullableInt64 `json:"end,omitempty"`
Id int64 `json:"id"`
Scope []string `json:"scope,omitempty"`
Start *int64 `json:"start,omitempty"`
}{}
err = json.Unmarshal(bytes, &required)
if err != nil {
return err
}
if required.Id == nil {
return fmt.Errorf("required field id missing")
}
err = json.Unmarshal(bytes, &all)
if err != nil {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
return nil
}
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"end", "id", "scope", "start"})
} else {
return err
}
o.End = all.End
o.Id = all.Id
o.Scope = all.Scope
o.Start = all.Start
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

return nil
}
Loading

0 comments on commit 4fdb91b

Please sign in to comment.