-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support schema version parameter in Get and List Service Definition e…
…ndpoints (#1991) Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
ff76b1d
commit 7ab24e2
Showing
11 changed files
with
515 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
api/datadogV2/model_service_definition_schema_versions.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// 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 ( | ||
"encoding/json" | ||
"fmt" | ||
) | ||
|
||
// ServiceDefinitionSchemaVersions Schema versions | ||
type ServiceDefinitionSchemaVersions string | ||
|
||
// List of ServiceDefinitionSchemaVersions. | ||
const ( | ||
SERVICEDEFINITIONSCHEMAVERSIONS_V1 ServiceDefinitionSchemaVersions = "v1" | ||
SERVICEDEFINITIONSCHEMAVERSIONS_V2 ServiceDefinitionSchemaVersions = "v2" | ||
SERVICEDEFINITIONSCHEMAVERSIONS_V2_1 ServiceDefinitionSchemaVersions = "v2.1" | ||
) | ||
|
||
var allowedServiceDefinitionSchemaVersionsEnumValues = []ServiceDefinitionSchemaVersions{ | ||
SERVICEDEFINITIONSCHEMAVERSIONS_V1, | ||
SERVICEDEFINITIONSCHEMAVERSIONS_V2, | ||
SERVICEDEFINITIONSCHEMAVERSIONS_V2_1, | ||
} | ||
|
||
// GetAllowedValues reeturns the list of possible values. | ||
func (v *ServiceDefinitionSchemaVersions) GetAllowedValues() []ServiceDefinitionSchemaVersions { | ||
return allowedServiceDefinitionSchemaVersionsEnumValues | ||
} | ||
|
||
// UnmarshalJSON deserializes the given payload. | ||
func (v *ServiceDefinitionSchemaVersions) UnmarshalJSON(src []byte) error { | ||
var value string | ||
err := json.Unmarshal(src, &value) | ||
if err != nil { | ||
return err | ||
} | ||
*v = ServiceDefinitionSchemaVersions(value) | ||
return nil | ||
} | ||
|
||
// NewServiceDefinitionSchemaVersionsFromValue returns a pointer to a valid ServiceDefinitionSchemaVersions | ||
// for the value passed as argument, or an error if the value passed is not allowed by the enum. | ||
func NewServiceDefinitionSchemaVersionsFromValue(v string) (*ServiceDefinitionSchemaVersions, error) { | ||
ev := ServiceDefinitionSchemaVersions(v) | ||
if ev.IsValid() { | ||
return &ev, nil | ||
} | ||
return nil, fmt.Errorf("invalid value '%v' for ServiceDefinitionSchemaVersions: valid values are %v", v, allowedServiceDefinitionSchemaVersionsEnumValues) | ||
} | ||
|
||
// IsValid return true if the value is valid for the enum, false otherwise. | ||
func (v ServiceDefinitionSchemaVersions) IsValid() bool { | ||
for _, existing := range allowedServiceDefinitionSchemaVersionsEnumValues { | ||
if existing == v { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
// Ptr returns reference to ServiceDefinitionSchemaVersions value. | ||
func (v ServiceDefinitionSchemaVersions) Ptr() *ServiceDefinitionSchemaVersions { | ||
return &v | ||
} | ||
|
||
// NullableServiceDefinitionSchemaVersions handles when a null is used for ServiceDefinitionSchemaVersions. | ||
type NullableServiceDefinitionSchemaVersions struct { | ||
value *ServiceDefinitionSchemaVersions | ||
isSet bool | ||
} | ||
|
||
// Get returns the associated value. | ||
func (v NullableServiceDefinitionSchemaVersions) Get() *ServiceDefinitionSchemaVersions { | ||
return v.value | ||
} | ||
|
||
// Set changes the value and indicates it's been called. | ||
func (v *NullableServiceDefinitionSchemaVersions) Set(val *ServiceDefinitionSchemaVersions) { | ||
v.value = val | ||
v.isSet = true | ||
} | ||
|
||
// IsSet returns whether Set has been called. | ||
func (v NullableServiceDefinitionSchemaVersions) IsSet() bool { | ||
return v.isSet | ||
} | ||
|
||
// Unset sets the value to nil and resets the set flag. | ||
func (v *NullableServiceDefinitionSchemaVersions) Unset() { | ||
v.value = nil | ||
v.isSet = false | ||
} | ||
|
||
// NewNullableServiceDefinitionSchemaVersions initializes the struct as if Set has been called. | ||
func NewNullableServiceDefinitionSchemaVersions(val *ServiceDefinitionSchemaVersions) *NullableServiceDefinitionSchemaVersions { | ||
return &NullableServiceDefinitionSchemaVersions{value: val, isSet: true} | ||
} | ||
|
||
// MarshalJSON serializes the associated value. | ||
func (v NullableServiceDefinitionSchemaVersions) MarshalJSON() ([]byte, error) { | ||
return json.Marshal(v.value) | ||
} | ||
|
||
// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. | ||
func (v *NullableServiceDefinitionSchemaVersions) UnmarshalJSON(src []byte) error { | ||
v.isSet = true | ||
return json.Unmarshal(src, &v.value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...re_Service_Definition/Scenario_Get_a_single_service_definition_returns_OK_response.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2022-11-14T18:09:34.511Z | ||
2023-05-11T21:16:09.344Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eature_Service_Definition/Scenario_Get_all_service_definitions_returns_OK_response.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2022-10-10T12:54:43.916Z | ||
2023-05-11T21:15:27.277Z |
Oops, something went wrong.