-
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.
Regenerate client from commit 201be608 of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Oct 12, 2023
1 parent
a4da59e
commit 897ff56
Showing
4 changed files
with
200 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
// 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 ( | ||
"github.com/goccy/go-json" | ||
|
||
"github.com/DataDog/datadog-api-client-go/v2/api/datadog" | ||
) | ||
|
||
// IPPrefixesGlobal Available prefix information for all Datadog endpoints. | ||
type IPPrefixesGlobal struct { | ||
// List of IPv4 prefixes. | ||
PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` | ||
// List of IPv6 prefixes. | ||
PrefixesIpv6 []string `json:"prefixes_ipv6,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{} | ||
} | ||
|
||
// NewIPPrefixesGlobal instantiates a new IPPrefixesGlobal 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 NewIPPrefixesGlobal() *IPPrefixesGlobal { | ||
this := IPPrefixesGlobal{} | ||
return &this | ||
} | ||
|
||
// NewIPPrefixesGlobalWithDefaults instantiates a new IPPrefixesGlobal 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 NewIPPrefixesGlobalWithDefaults() *IPPrefixesGlobal { | ||
this := IPPrefixesGlobal{} | ||
return &this | ||
} | ||
|
||
// GetPrefixesIpv4 returns the PrefixesIpv4 field value if set, zero value otherwise. | ||
func (o *IPPrefixesGlobal) GetPrefixesIpv4() []string { | ||
if o == nil || o.PrefixesIpv4 == nil { | ||
var ret []string | ||
return ret | ||
} | ||
return o.PrefixesIpv4 | ||
} | ||
|
||
// GetPrefixesIpv4Ok returns a tuple with the PrefixesIpv4 field value if set, nil otherwise | ||
// and a boolean to check if the value has been set. | ||
func (o *IPPrefixesGlobal) GetPrefixesIpv4Ok() (*[]string, bool) { | ||
if o == nil || o.PrefixesIpv4 == nil { | ||
return nil, false | ||
} | ||
return &o.PrefixesIpv4, true | ||
} | ||
|
||
// HasPrefixesIpv4 returns a boolean if a field has been set. | ||
func (o *IPPrefixesGlobal) HasPrefixesIpv4() bool { | ||
return o != nil && o.PrefixesIpv4 != nil | ||
} | ||
|
||
// SetPrefixesIpv4 gets a reference to the given []string and assigns it to the PrefixesIpv4 field. | ||
func (o *IPPrefixesGlobal) SetPrefixesIpv4(v []string) { | ||
o.PrefixesIpv4 = v | ||
} | ||
|
||
// GetPrefixesIpv6 returns the PrefixesIpv6 field value if set, zero value otherwise. | ||
func (o *IPPrefixesGlobal) GetPrefixesIpv6() []string { | ||
if o == nil || o.PrefixesIpv6 == nil { | ||
var ret []string | ||
return ret | ||
} | ||
return o.PrefixesIpv6 | ||
} | ||
|
||
// GetPrefixesIpv6Ok returns a tuple with the PrefixesIpv6 field value if set, nil otherwise | ||
// and a boolean to check if the value has been set. | ||
func (o *IPPrefixesGlobal) GetPrefixesIpv6Ok() (*[]string, bool) { | ||
if o == nil || o.PrefixesIpv6 == nil { | ||
return nil, false | ||
} | ||
return &o.PrefixesIpv6, true | ||
} | ||
|
||
// HasPrefixesIpv6 returns a boolean if a field has been set. | ||
func (o *IPPrefixesGlobal) HasPrefixesIpv6() bool { | ||
return o != nil && o.PrefixesIpv6 != nil | ||
} | ||
|
||
// SetPrefixesIpv6 gets a reference to the given []string and assigns it to the PrefixesIpv6 field. | ||
func (o *IPPrefixesGlobal) SetPrefixesIpv6(v []string) { | ||
o.PrefixesIpv6 = v | ||
} | ||
|
||
// MarshalJSON serializes the struct using spec logic. | ||
func (o IPPrefixesGlobal) MarshalJSON() ([]byte, error) { | ||
toSerialize := map[string]interface{}{} | ||
if o.UnparsedObject != nil { | ||
return json.Marshal(o.UnparsedObject) | ||
} | ||
if o.PrefixesIpv4 != nil { | ||
toSerialize["prefixes_ipv4"] = o.PrefixesIpv4 | ||
} | ||
if o.PrefixesIpv6 != nil { | ||
toSerialize["prefixes_ipv6"] = o.PrefixesIpv6 | ||
} | ||
|
||
for key, value := range o.AdditionalProperties { | ||
toSerialize[key] = value | ||
} | ||
return json.Marshal(toSerialize) | ||
} | ||
|
||
// UnmarshalJSON deserializes the given payload. | ||
func (o *IPPrefixesGlobal) UnmarshalJSON(bytes []byte) (err error) { | ||
all := struct { | ||
PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` | ||
PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` | ||
}{} | ||
if err = json.Unmarshal(bytes, &all); err != nil { | ||
return json.Unmarshal(bytes, &o.UnparsedObject) | ||
} | ||
additionalProperties := make(map[string]interface{}) | ||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil { | ||
datadog.DeleteKeys(additionalProperties, &[]string{"prefixes_ipv4", "prefixes_ipv6"}) | ||
} else { | ||
return err | ||
} | ||
o.PrefixesIpv4 = all.PrefixesIpv4 | ||
o.PrefixesIpv6 = all.PrefixesIpv6 | ||
|
||
if len(additionalProperties) > 0 { | ||
o.AdditionalProperties = additionalProperties | ||
} | ||
|
||
return nil | ||
} |
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