From 75746881f525d10adc8abe3b364feb483b04b928 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 26 Jul 2023 14:59:58 +0000 Subject: [PATCH] Regenerate client from commit 3d6b3d5a of spec repo --- .apigentools-info | 8 +-- .generator/schemas/v2/openapi.yaml | 9 +++ .../model_on_demand_concurrency_cap.go | 45 ++++++++++++- .../model_on_demand_concurrency_cap_type.go | 64 +++++++++++++++++++ 4 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 api/datadogV2/model_on_demand_concurrency_cap_type.go diff --git a/.apigentools-info b/.apigentools-info index 65c245939c5..2a9381b2e07 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.5", - "regenerated": "2023-07-26 14:17:56.191620", - "spec_repo_commit": "835cb6df" + "regenerated": "2023-07-26 14:58:27.908695", + "spec_repo_commit": "3d6b3d5a" }, "v2": { "apigentools_version": "1.6.5", - "regenerated": "2023-07-26 14:17:56.204862", - "spec_repo_commit": "835cb6df" + "regenerated": "2023-07-26 14:58:27.923303", + "spec_repo_commit": "3d6b3d5a" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3fcd775274c..b1c772d8edd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -10110,6 +10110,8 @@ components: properties: attributes: $ref: '#/components/schemas/OnDemandConcurrencyCapAttributes' + type: + $ref: '#/components/schemas/OnDemandConcurrencyCapType' type: object OnDemandConcurrencyCapAttributes: description: On-demand concurrency cap attributes. @@ -10125,6 +10127,13 @@ components: data: $ref: '#/components/schemas/OnDemandConcurrencyCap' type: object + OnDemandConcurrencyCapType: + description: On-demand concurrency cap type. + enum: + - on_demand_concurrency_cap + type: string + x-enum-varnames: + - ON_DEMAND_CONCURRENCY_CAP OpsgenieServiceCreateAttributes: description: The Opsgenie service attributes for a create request. properties: diff --git a/api/datadogV2/model_on_demand_concurrency_cap.go b/api/datadogV2/model_on_demand_concurrency_cap.go index a77baea4168..7ef317a06ca 100644 --- a/api/datadogV2/model_on_demand_concurrency_cap.go +++ b/api/datadogV2/model_on_demand_concurrency_cap.go @@ -14,6 +14,8 @@ import ( type OnDemandConcurrencyCap struct { // On-demand concurrency cap attributes. Attributes *OnDemandConcurrencyCapAttributes `json:"attributes,omitempty"` + // On-demand concurrency cap type. + Type *OnDemandConcurrencyCapType `json:"type,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{} @@ -64,6 +66,34 @@ func (o *OnDemandConcurrencyCap) SetAttributes(v OnDemandConcurrencyCapAttribute o.Attributes = &v } +// GetType returns the Type field value if set, zero value otherwise. +func (o *OnDemandConcurrencyCap) GetType() OnDemandConcurrencyCapType { + if o == nil || o.Type == nil { + var ret OnDemandConcurrencyCapType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OnDemandConcurrencyCap) GetTypeOk() (*OnDemandConcurrencyCapType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *OnDemandConcurrencyCap) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given OnDemandConcurrencyCapType and assigns it to the Type field. +func (o *OnDemandConcurrencyCap) SetType(v OnDemandConcurrencyCapType) { + o.Type = &v +} + // MarshalJSON serializes the struct using spec logic. func (o OnDemandConcurrencyCap) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -73,6 +103,9 @@ func (o OnDemandConcurrencyCap) MarshalJSON() ([]byte, error) { if o.Attributes != nil { toSerialize["attributes"] = o.Attributes } + if o.Type != nil { + toSerialize["type"] = o.Type + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -85,6 +118,7 @@ func (o *OnDemandConcurrencyCap) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} all := struct { Attributes *OnDemandConcurrencyCapAttributes `json:"attributes,omitempty"` + Type *OnDemandConcurrencyCapType `json:"type,omitempty"` }{} if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) @@ -96,10 +130,18 @@ func (o *OnDemandConcurrencyCap) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes"}) + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) } else { return err } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -108,6 +150,7 @@ func (o *OnDemandConcurrencyCap) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes + o.Type = all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_on_demand_concurrency_cap_type.go b/api/datadogV2/model_on_demand_concurrency_cap_type.go new file mode 100644 index 00000000000..d4a5a540a88 --- /dev/null +++ b/api/datadogV2/model_on_demand_concurrency_cap_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/goccy/go-json" +) + +// OnDemandConcurrencyCapType On-demand concurrency cap type. +type OnDemandConcurrencyCapType string + +// List of OnDemandConcurrencyCapType. +const ( + ONDEMANDCONCURRENCYCAPTYPE_ON_DEMAND_CONCURRENCY_CAP OnDemandConcurrencyCapType = "on_demand_concurrency_cap" +) + +var allowedOnDemandConcurrencyCapTypeEnumValues = []OnDemandConcurrencyCapType{ + ONDEMANDCONCURRENCYCAPTYPE_ON_DEMAND_CONCURRENCY_CAP, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *OnDemandConcurrencyCapType) GetAllowedValues() []OnDemandConcurrencyCapType { + return allowedOnDemandConcurrencyCapTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *OnDemandConcurrencyCapType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = OnDemandConcurrencyCapType(value) + return nil +} + +// NewOnDemandConcurrencyCapTypeFromValue returns a pointer to a valid OnDemandConcurrencyCapType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewOnDemandConcurrencyCapTypeFromValue(v string) (*OnDemandConcurrencyCapType, error) { + ev := OnDemandConcurrencyCapType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for OnDemandConcurrencyCapType: valid values are %v", v, allowedOnDemandConcurrencyCapTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v OnDemandConcurrencyCapType) IsValid() bool { + for _, existing := range allowedOnDemandConcurrencyCapTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OnDemandConcurrencyCapType value. +func (v OnDemandConcurrencyCapType) Ptr() *OnDemandConcurrencyCapType { + return &v +}