Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global IP ranges to spec #1878

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.6",
"regenerated": "2023-10-12 16:54:30.986438",
"spec_repo_commit": "a04c27c5"
"regenerated": "2023-10-12 17:29:32.714151",
"spec_repo_commit": "201be608"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-12 16:54:31.006071",
"spec_repo_commit": "a04c27c5"
"regenerated": "2023-10-12 17:29:32.729493",
"spec_repo_commit": "201be608"
}
}
}
18 changes: 18 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4045,6 +4045,22 @@ components:
type: string
type: array
type: object
IPPrefixesGlobal:
description: Available prefix information for all Datadog endpoints.
properties:
prefixes_ipv4:
description: List of IPv4 prefixes.
items:
description: IPv4 prefix
type: string
type: array
prefixes_ipv6:
description: List of IPv6 prefixes.
items:
description: IPv6 prefix
type: string
type: array
type: object
IPPrefixesLogs:
description: Available prefix information for the Logs endpoints.
properties:
Expand Down Expand Up @@ -4185,6 +4201,8 @@ components:
$ref: '#/components/schemas/IPPrefixesAPI'
apm:
$ref: '#/components/schemas/IPPrefixesAPM'
global:
$ref: '#/components/schemas/IPPrefixesGlobal'
logs:
$ref: '#/components/schemas/IPPrefixesLogs'
modified:
Expand Down
139 changes: 139 additions & 0 deletions api/datadogV1/model_ip_prefixes_global.go
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
}
40 changes: 39 additions & 1 deletion api/datadogV1/model_ip_ranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type IPRanges struct {
Api *IPPrefixesAPI `json:"api,omitempty"`
// Available prefix information for the APM endpoints.
Apm *IPPrefixesAPM `json:"apm,omitempty"`
// Available prefix information for all Datadog endpoints.
Global *IPPrefixesGlobal `json:"global,omitempty"`
// Available prefix information for the Logs endpoints.
Logs *IPPrefixesLogs `json:"logs,omitempty"`
// Date when last updated, in the form `YYYY-MM-DD-hh-mm-ss`.
Expand Down Expand Up @@ -142,6 +144,34 @@ func (o *IPRanges) SetApm(v IPPrefixesAPM) {
o.Apm = &v
}

// GetGlobal returns the Global field value if set, zero value otherwise.
func (o *IPRanges) GetGlobal() IPPrefixesGlobal {
if o == nil || o.Global == nil {
var ret IPPrefixesGlobal
return ret
}
return *o.Global
}

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

// HasGlobal returns a boolean if a field has been set.
func (o *IPRanges) HasGlobal() bool {
return o != nil && o.Global != nil
}

// SetGlobal gets a reference to the given IPPrefixesGlobal and assigns it to the Global field.
func (o *IPRanges) SetGlobal(v IPPrefixesGlobal) {
o.Global = &v
}

// GetLogs returns the Logs field value if set, zero value otherwise.
func (o *IPRanges) GetLogs() IPPrefixesLogs {
if o == nil || o.Logs == nil {
Expand Down Expand Up @@ -409,6 +439,9 @@ func (o IPRanges) MarshalJSON() ([]byte, error) {
if o.Apm != nil {
toSerialize["apm"] = o.Apm
}
if o.Global != nil {
toSerialize["global"] = o.Global
}
if o.Logs != nil {
toSerialize["logs"] = o.Logs
}
Expand Down Expand Up @@ -449,6 +482,7 @@ func (o *IPRanges) UnmarshalJSON(bytes []byte) (err error) {
Agents *IPPrefixesAgents `json:"agents,omitempty"`
Api *IPPrefixesAPI `json:"api,omitempty"`
Apm *IPPrefixesAPM `json:"apm,omitempty"`
Global *IPPrefixesGlobal `json:"global,omitempty"`
Logs *IPPrefixesLogs `json:"logs,omitempty"`
Modified *string `json:"modified,omitempty"`
Orchestrator *IPPrefixesOrchestrator `json:"orchestrator,omitempty"`
Expand All @@ -464,7 +498,7 @@ func (o *IPRanges) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"agents", "api", "apm", "logs", "modified", "orchestrator", "process", "remote-configuration", "synthetics", "synthetics-private-locations", "version", "webhooks"})
datadog.DeleteKeys(additionalProperties, &[]string{"agents", "api", "apm", "global", "logs", "modified", "orchestrator", "process", "remote-configuration", "synthetics", "synthetics-private-locations", "version", "webhooks"})
} else {
return err
}
Expand All @@ -482,6 +516,10 @@ func (o *IPRanges) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField = true
}
o.Apm = all.Apm
if all.Global != nil && all.Global.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Global = all.Global
if all.Logs != nil && all.Logs.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
Expand Down
Loading