From b8167024aa8770716bdd27fd41d767ae8dc99305 Mon Sep 17 00:00:00 2001 From: Ashish Mathew Date: Fri, 23 Feb 2024 10:30:31 -0800 Subject: [PATCH] fix: fqdn should be optional in ConfigForwarder --- dns_config/docs/ConfigForwarder.md | 9 +++++-- dns_config/model_config_forwarder.go | 35 +++++++++++++++++----------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/dns_config/docs/ConfigForwarder.md b/dns_config/docs/ConfigForwarder.md index 6394250..2304007 100644 --- a/dns_config/docs/ConfigForwarder.md +++ b/dns_config/docs/ConfigForwarder.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Address** | **string** | Server IP address. | -**Fqdn** | **string** | Server FQDN. | +**Fqdn** | Pointer to **string** | Server FQDN. | [optional] **ProtocolFqdn** | Pointer to **string** | Server FQDN in punycode. | [optional] [readonly] ## Methods ### NewConfigForwarder -`func NewConfigForwarder(address string, fqdn string, ) *ConfigForwarder` +`func NewConfigForwarder(address string, ) *ConfigForwarder` NewConfigForwarder instantiates a new ConfigForwarder object This constructor will assign default values to properties that have it defined, @@ -66,6 +66,11 @@ and a boolean to check if the value has been set. SetFqdn sets Fqdn field to given value. +### HasFqdn + +`func (o *ConfigForwarder) HasFqdn() bool` + +HasFqdn returns a boolean if a field has been set. ### GetProtocolFqdn diff --git a/dns_config/model_config_forwarder.go b/dns_config/model_config_forwarder.go index 44684ac..f583e4a 100644 --- a/dns_config/model_config_forwarder.go +++ b/dns_config/model_config_forwarder.go @@ -22,7 +22,7 @@ type ConfigForwarder struct { // Server IP address. Address string `json:"address"` // Server FQDN. - Fqdn string `json:"fqdn"` + Fqdn *string `json:"fqdn,omitempty"` // Server FQDN in punycode. ProtocolFqdn *string `json:"protocol_fqdn,omitempty"` } @@ -31,10 +31,9 @@ type ConfigForwarder struct { // 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 NewConfigForwarder(address string, fqdn string) *ConfigForwarder { +func NewConfigForwarder(address string) *ConfigForwarder { this := ConfigForwarder{} this.Address = address - this.Fqdn = fqdn return &this } @@ -70,28 +69,36 @@ func (o *ConfigForwarder) SetAddress(v string) { o.Address = v } -// GetFqdn returns the Fqdn field value +// GetFqdn returns the Fqdn field value if set, zero value otherwise. func (o *ConfigForwarder) GetFqdn() string { - if o == nil { + if o == nil || IsNil(o.Fqdn) { var ret string return ret } - - return o.Fqdn + return *o.Fqdn } -// GetFqdnOk returns a tuple with the Fqdn field value +// GetFqdnOk returns a tuple with the Fqdn field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConfigForwarder) GetFqdnOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Fqdn) { return nil, false } - return &o.Fqdn, true + return o.Fqdn, true +} + +// HasFqdn returns a boolean if a field has been set. +func (o *ConfigForwarder) HasFqdn() bool { + if o != nil && !IsNil(o.Fqdn) { + return true + } + + return false } -// SetFqdn sets field value +// SetFqdn gets a reference to the given string and assigns it to the Fqdn field. func (o *ConfigForwarder) SetFqdn(v string) { - o.Fqdn = v + o.Fqdn = &v } // GetProtocolFqdn returns the ProtocolFqdn field value if set, zero value otherwise. @@ -137,7 +144,9 @@ func (o ConfigForwarder) MarshalJSON() ([]byte, error) { func (o ConfigForwarder) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["address"] = o.Address - toSerialize["fqdn"] = o.Fqdn + if !IsNil(o.Fqdn) { + toSerialize["fqdn"] = o.Fqdn + } if !IsNil(o.ProtocolFqdn) { toSerialize["protocol_fqdn"] = o.ProtocolFqdn }