From 54d2026540f3ab24a8084adf44cb916f9f2c6461 Mon Sep 17 00:00:00 2001 From: Leaseweb CI Date: Thu, 19 Dec 2024 09:07:10 +0000 Subject: [PATCH] feat: set required fields for listing resource record sets --- dns/api/openapi.yaml | 24 +++- dns/docs/BaseResourceRecordSetList.md | 9 +- dns/docs/Collection.md | 9 +- dns/docs/GetResourceRecordSetListLdResult.md | 16 +-- dns/docs/GetResourceRecordSetListResult.md | 16 +-- dns/docs/LdLinks.md | 16 +-- dns/docs/LdResourceRecordSetDetails.md | 9 +- dns/docs/Links.md | 23 +--- dns/docs/Parent.md | 9 +- dns/docs/ResourceRecordSetDetails.md | 9 +- dns/docs/Self.md | 9 +- dns/docs/ValidateSet.md | 9 +- dns/model_base_resource_record_set_list.go | 57 +++++--- dns/model_collection.go | 57 +++++--- ..._get_resource_record_set_list_ld_result.go | 85 ++++++------ ...del_get_resource_record_set_list_result.go | 85 ++++++------ dns/model_ld_links.go | 91 +++++++------ dns/model_ld_resource_record_set_details.go | 36 ++--- dns/model_links.go | 125 +++++++++--------- dns/model_parent.go | 57 +++++--- dns/model_resource_record_set_details.go | 36 ++--- dns/model_self.go | 57 +++++--- dns/model_validate_set.go | 57 +++++--- 23 files changed, 452 insertions(+), 449 deletions(-) diff --git a/dns/api/openapi.yaml b/dns/api/openapi.yaml index ed91499..50c9514 100644 --- a/dns/api/openapi.yaml +++ b/dns/api/openapi.yaml @@ -1615,6 +1615,8 @@ components: description: Hyperlink to the resource record set's location example: /domains/example.com/resourceRecordSets/example.com./A+GEO type: string + required: + - href title: self type: object ldLinks: @@ -1629,6 +1631,9 @@ components: $ref: '#/components/schemas/self' collection: $ref: '#/components/schemas/collection' + required: + - collection + - self title: ldLinks type: object name: @@ -1703,6 +1708,7 @@ components: _links: $ref: '#/components/schemas/ldLinks' required: + - _links - editable title: resourceRecordSetDetails type: object @@ -1741,6 +1747,10 @@ components: $ref: '#/components/schemas/parent' validateSet: $ref: '#/components/schemas/validateSet' + required: + - parent + - self + - validateSet title: links type: object baseResourceRecordSetList: @@ -1752,6 +1762,8 @@ components: type: string _links: $ref: '#/components/schemas/links' + required: + - _links type: object getResourceRecordSetListResult: allOf: @@ -1761,6 +1773,8 @@ components: items: $ref: '#/components/schemas/resourceRecordSetDetails' type: array + required: + - resourceRecordSets type: object - $ref: '#/components/schemas/baseResourceRecordSetList' example: @@ -1844,8 +1858,8 @@ components: _links: $ref: '#/components/schemas/ldLinks' required: + - _links - editable - - ttl title: ldResourceRecordSetDetails type: object - $ref: '#/components/schemas/ldResourceRecordSet' @@ -1857,6 +1871,8 @@ components: items: $ref: '#/components/schemas/ldResourceRecordSetDetails' type: array + required: + - resourceRecordSets type: object - $ref: '#/components/schemas/baseResourceRecordSetList' errorResult: @@ -2024,6 +2040,8 @@ components: description: Hyperlink to the resource record sets collection location example: /domains/example.com/resourceRecordSets type: string + required: + - href title: collection type: object parent: @@ -2035,6 +2053,8 @@ components: description: Hyperlink to the parent resource location example: /domains/example.com type: string + required: + - href title: parent type: object validateSet: @@ -2046,6 +2066,8 @@ components: description: Hyperlink to validate a single resource record set for a domain example: /domains/example.com/resourceRecordSets/validateSet type: string + required: + - href title: validateSet type: object securitySchemes: diff --git a/dns/docs/BaseResourceRecordSetList.md b/dns/docs/BaseResourceRecordSetList.md index b6fcb4e..3b8d076 100644 --- a/dns/docs/BaseResourceRecordSetList.md +++ b/dns/docs/BaseResourceRecordSetList.md @@ -5,13 +5,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **InfoMessage** | Pointer to **string** | Optional additional information | [optional] -**Links** | Pointer to [**Links**](Links.md) | | [optional] +**Links** | [**Links**](Links.md) | | ## Methods ### NewBaseResourceRecordSetList -`func NewBaseResourceRecordSetList() *BaseResourceRecordSetList` +`func NewBaseResourceRecordSetList(links Links, ) *BaseResourceRecordSetList` NewBaseResourceRecordSetList instantiates a new BaseResourceRecordSetList object This constructor will assign default values to properties that have it defined, @@ -70,11 +70,6 @@ and a boolean to check if the value has been set. SetLinks sets Links field to given value. -### HasLinks - -`func (o *BaseResourceRecordSetList) HasLinks() bool` - -HasLinks returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/Collection.md b/dns/docs/Collection.md index 41f67eb..25f8ccf 100644 --- a/dns/docs/Collection.md +++ b/dns/docs/Collection.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Href** | Pointer to **string** | Hyperlink to the resource record sets collection location | [optional] +**Href** | **string** | Hyperlink to the resource record sets collection location | ## Methods ### NewCollection -`func NewCollection() *Collection` +`func NewCollection(href string, ) *Collection` NewCollection instantiates a new Collection object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetHref sets Href field to given value. -### HasHref - -`func (o *Collection) HasHref() bool` - -HasHref returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/GetResourceRecordSetListLdResult.md b/dns/docs/GetResourceRecordSetListLdResult.md index fb945cd..7e9b765 100644 --- a/dns/docs/GetResourceRecordSetListLdResult.md +++ b/dns/docs/GetResourceRecordSetListLdResult.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **InfoMessage** | Pointer to **string** | Optional additional information | [optional] -**Links** | Pointer to [**Links**](Links.md) | | [optional] -**ResourceRecordSets** | Pointer to [**[]LdResourceRecordSetDetails**](LdResourceRecordSetDetails.md) | Array of resource record sets | [optional] +**Links** | [**Links**](Links.md) | | +**ResourceRecordSets** | [**[]LdResourceRecordSetDetails**](LdResourceRecordSetDetails.md) | Array of resource record sets | ## Methods ### NewGetResourceRecordSetListLdResult -`func NewGetResourceRecordSetListLdResult() *GetResourceRecordSetListLdResult` +`func NewGetResourceRecordSetListLdResult(links Links, resourceRecordSets []LdResourceRecordSetDetails, ) *GetResourceRecordSetListLdResult` NewGetResourceRecordSetListLdResult instantiates a new GetResourceRecordSetListLdResult object This constructor will assign default values to properties that have it defined, @@ -71,11 +71,6 @@ and a boolean to check if the value has been set. SetLinks sets Links field to given value. -### HasLinks - -`func (o *GetResourceRecordSetListLdResult) HasLinks() bool` - -HasLinks returns a boolean if a field has been set. ### GetResourceRecordSets @@ -96,11 +91,6 @@ and a boolean to check if the value has been set. SetResourceRecordSets sets ResourceRecordSets field to given value. -### HasResourceRecordSets - -`func (o *GetResourceRecordSetListLdResult) HasResourceRecordSets() bool` - -HasResourceRecordSets returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/GetResourceRecordSetListResult.md b/dns/docs/GetResourceRecordSetListResult.md index eb440f3..663f05f 100644 --- a/dns/docs/GetResourceRecordSetListResult.md +++ b/dns/docs/GetResourceRecordSetListResult.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **InfoMessage** | Pointer to **string** | Optional additional information | [optional] -**Links** | Pointer to [**Links**](Links.md) | | [optional] -**ResourceRecordSets** | Pointer to [**[]ResourceRecordSetDetails**](ResourceRecordSetDetails.md) | Array of resource record sets | [optional] +**Links** | [**Links**](Links.md) | | +**ResourceRecordSets** | [**[]ResourceRecordSetDetails**](ResourceRecordSetDetails.md) | Array of resource record sets | ## Methods ### NewGetResourceRecordSetListResult -`func NewGetResourceRecordSetListResult() *GetResourceRecordSetListResult` +`func NewGetResourceRecordSetListResult(links Links, resourceRecordSets []ResourceRecordSetDetails, ) *GetResourceRecordSetListResult` NewGetResourceRecordSetListResult instantiates a new GetResourceRecordSetListResult object This constructor will assign default values to properties that have it defined, @@ -71,11 +71,6 @@ and a boolean to check if the value has been set. SetLinks sets Links field to given value. -### HasLinks - -`func (o *GetResourceRecordSetListResult) HasLinks() bool` - -HasLinks returns a boolean if a field has been set. ### GetResourceRecordSets @@ -96,11 +91,6 @@ and a boolean to check if the value has been set. SetResourceRecordSets sets ResourceRecordSets field to given value. -### HasResourceRecordSets - -`func (o *GetResourceRecordSetListResult) HasResourceRecordSets() bool` - -HasResourceRecordSets returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/LdLinks.md b/dns/docs/LdLinks.md index 6253800..fd03412 100644 --- a/dns/docs/LdLinks.md +++ b/dns/docs/LdLinks.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Self** | Pointer to [**Self**](Self.md) | | [optional] -**Collection** | Pointer to [**Collection**](Collection.md) | | [optional] +**Self** | [**Self**](Self.md) | | +**Collection** | [**Collection**](Collection.md) | | ## Methods ### NewLdLinks -`func NewLdLinks() *LdLinks` +`func NewLdLinks(self Self, collection Collection, ) *LdLinks` NewLdLinks instantiates a new LdLinks object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetSelf sets Self field to given value. -### HasSelf - -`func (o *LdLinks) HasSelf() bool` - -HasSelf returns a boolean if a field has been set. ### GetCollection @@ -70,11 +65,6 @@ and a boolean to check if the value has been set. SetCollection sets Collection field to given value. -### HasCollection - -`func (o *LdLinks) HasCollection() bool` - -HasCollection returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/LdResourceRecordSetDetails.md b/dns/docs/LdResourceRecordSetDetails.md index d741420..62a0bf5 100644 --- a/dns/docs/LdResourceRecordSetDetails.md +++ b/dns/docs/LdResourceRecordSetDetails.md @@ -9,13 +9,13 @@ Name | Type | Description | Notes **GeoContent** | [**GeoContent**](GeoContent.md) | | **Ttl** | [**Ttl**](Ttl.md) | | **Editable** | **bool** | May the set be edited | -**Links** | Pointer to [**LdLinks**](LdLinks.md) | | [optional] +**Links** | [**LdLinks**](LdLinks.md) | | ## Methods ### NewLdResourceRecordSetDetails -`func NewLdResourceRecordSetDetails(name string, type_ LdResourceRecordSetType, geoContent GeoContent, ttl Ttl, editable bool, ) *LdResourceRecordSetDetails` +`func NewLdResourceRecordSetDetails(name string, type_ LdResourceRecordSetType, geoContent GeoContent, ttl Ttl, editable bool, links LdLinks, ) *LdResourceRecordSetDetails` NewLdResourceRecordSetDetails instantiates a new LdResourceRecordSetDetails object This constructor will assign default values to properties that have it defined, @@ -149,11 +149,6 @@ and a boolean to check if the value has been set. SetLinks sets Links field to given value. -### HasLinks - -`func (o *LdResourceRecordSetDetails) HasLinks() bool` - -HasLinks returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/Links.md b/dns/docs/Links.md index 781a2ee..562c452 100644 --- a/dns/docs/Links.md +++ b/dns/docs/Links.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Self** | Pointer to [**Self**](Self.md) | | [optional] -**Parent** | Pointer to [**Parent**](Parent.md) | | [optional] -**ValidateSet** | Pointer to [**ValidateSet**](ValidateSet.md) | | [optional] +**Self** | [**Self**](Self.md) | | +**Parent** | [**Parent**](Parent.md) | | +**ValidateSet** | [**ValidateSet**](ValidateSet.md) | | ## Methods ### NewLinks -`func NewLinks() *Links` +`func NewLinks(self Self, parent Parent, validateSet ValidateSet, ) *Links` NewLinks instantiates a new Links object This constructor will assign default values to properties that have it defined, @@ -46,11 +46,6 @@ and a boolean to check if the value has been set. SetSelf sets Self field to given value. -### HasSelf - -`func (o *Links) HasSelf() bool` - -HasSelf returns a boolean if a field has been set. ### GetParent @@ -71,11 +66,6 @@ and a boolean to check if the value has been set. SetParent sets Parent field to given value. -### HasParent - -`func (o *Links) HasParent() bool` - -HasParent returns a boolean if a field has been set. ### GetValidateSet @@ -96,11 +86,6 @@ and a boolean to check if the value has been set. SetValidateSet sets ValidateSet field to given value. -### HasValidateSet - -`func (o *Links) HasValidateSet() bool` - -HasValidateSet returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/Parent.md b/dns/docs/Parent.md index 8efec3a..4c57a15 100644 --- a/dns/docs/Parent.md +++ b/dns/docs/Parent.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Href** | Pointer to **string** | Hyperlink to the parent resource location | [optional] +**Href** | **string** | Hyperlink to the parent resource location | ## Methods ### NewParent -`func NewParent() *Parent` +`func NewParent(href string, ) *Parent` NewParent instantiates a new Parent object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetHref sets Href field to given value. -### HasHref - -`func (o *Parent) HasHref() bool` - -HasHref returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/ResourceRecordSetDetails.md b/dns/docs/ResourceRecordSetDetails.md index a6b541f..258c79b 100644 --- a/dns/docs/ResourceRecordSetDetails.md +++ b/dns/docs/ResourceRecordSetDetails.md @@ -9,13 +9,13 @@ Name | Type | Description | Notes **Content** | **[]string** | Array of resource record set content entries | **Ttl** | [**Ttl**](Ttl.md) | | **Editable** | **bool** | May the set be edited | -**Links** | Pointer to [**LdLinks**](LdLinks.md) | | [optional] +**Links** | [**LdLinks**](LdLinks.md) | | ## Methods ### NewResourceRecordSetDetails -`func NewResourceRecordSetDetails(name string, type_ ResourceRecordSetType, content []string, ttl Ttl, editable bool, ) *ResourceRecordSetDetails` +`func NewResourceRecordSetDetails(name string, type_ ResourceRecordSetType, content []string, ttl Ttl, editable bool, links LdLinks, ) *ResourceRecordSetDetails` NewResourceRecordSetDetails instantiates a new ResourceRecordSetDetails object This constructor will assign default values to properties that have it defined, @@ -149,11 +149,6 @@ and a boolean to check if the value has been set. SetLinks sets Links field to given value. -### HasLinks - -`func (o *ResourceRecordSetDetails) HasLinks() bool` - -HasLinks returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/Self.md b/dns/docs/Self.md index 80a2d2e..a0a46a2 100644 --- a/dns/docs/Self.md +++ b/dns/docs/Self.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Href** | Pointer to **string** | Hyperlink to the resource record set's location | [optional] +**Href** | **string** | Hyperlink to the resource record set's location | ## Methods ### NewSelf -`func NewSelf() *Self` +`func NewSelf(href string, ) *Self` NewSelf instantiates a new Self object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetHref sets Href field to given value. -### HasHref - -`func (o *Self) HasHref() bool` - -HasHref returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/docs/ValidateSet.md b/dns/docs/ValidateSet.md index b9a5f4f..c09e1fb 100644 --- a/dns/docs/ValidateSet.md +++ b/dns/docs/ValidateSet.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Href** | Pointer to **string** | Hyperlink to validate a single resource record set for a domain | [optional] +**Href** | **string** | Hyperlink to validate a single resource record set for a domain | ## Methods ### NewValidateSet -`func NewValidateSet() *ValidateSet` +`func NewValidateSet(href string, ) *ValidateSet` NewValidateSet instantiates a new ValidateSet object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetHref sets Href field to given value. -### HasHref - -`func (o *ValidateSet) HasHref() bool` - -HasHref returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/dns/model_base_resource_record_set_list.go b/dns/model_base_resource_record_set_list.go index d05a453..733b550 100644 --- a/dns/model_base_resource_record_set_list.go +++ b/dns/model_base_resource_record_set_list.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the BaseResourceRecordSetList type satisfies the MappedNullable interface at compile time @@ -21,7 +22,7 @@ var _ MappedNullable = &BaseResourceRecordSetList{} type BaseResourceRecordSetList struct { // Optional additional information InfoMessage *string `json:"infoMessage,omitempty"` - Links *Links `json:"_links,omitempty"` + Links Links `json:"_links"` AdditionalProperties map[string]interface{} } @@ -31,8 +32,9 @@ type _BaseResourceRecordSetList BaseResourceRecordSetList // 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 NewBaseResourceRecordSetList() *BaseResourceRecordSetList { +func NewBaseResourceRecordSetList(links Links) *BaseResourceRecordSetList { this := BaseResourceRecordSetList{} + this.Links = links return &this } @@ -76,36 +78,28 @@ func (o *BaseResourceRecordSetList) SetInfoMessage(v string) { o.InfoMessage = &v } -// GetLinks returns the Links field value if set, zero value otherwise. +// GetLinks returns the Links field value func (o *BaseResourceRecordSetList) GetLinks() Links { - if o == nil || IsNil(o.Links) { + if o == nil { var ret Links return ret } - return *o.Links + + return o.Links } -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// GetLinksOk returns a tuple with the Links field value // and a boolean to check if the value has been set. func (o *BaseResourceRecordSetList) GetLinksOk() (*Links, bool) { - if o == nil || IsNil(o.Links) { + if o == nil { return nil, false } - return o.Links, true + return &o.Links, true } -// HasLinks returns a boolean if a field has been set. -func (o *BaseResourceRecordSetList) HasLinks() bool { - if o != nil && !IsNil(o.Links) { - return true - } - - return false -} - -// SetLinks gets a reference to the given Links and assigns it to the Links field. +// SetLinks sets field value func (o *BaseResourceRecordSetList) SetLinks(v Links) { - o.Links = &v + o.Links = v } func (o BaseResourceRecordSetList) MarshalJSON() ([]byte, error) { @@ -121,9 +115,7 @@ func (o BaseResourceRecordSetList) ToMap() (map[string]interface{}, error) { if !IsNil(o.InfoMessage) { toSerialize["infoMessage"] = o.InfoMessage } - if !IsNil(o.Links) { - toSerialize["_links"] = o.Links - } + toSerialize["_links"] = o.Links for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -133,6 +125,27 @@ func (o BaseResourceRecordSetList) ToMap() (map[string]interface{}, error) { } func (o *BaseResourceRecordSetList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "_links", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + varBaseResourceRecordSetList := _BaseResourceRecordSetList{} err = json.Unmarshal(data, &varBaseResourceRecordSetList) diff --git a/dns/model_collection.go b/dns/model_collection.go index b5565ab..8f30675 100644 --- a/dns/model_collection.go +++ b/dns/model_collection.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the Collection type satisfies the MappedNullable interface at compile time @@ -20,7 +21,7 @@ var _ MappedNullable = &Collection{} // Collection Link to the resource record sets collection type Collection struct { // Hyperlink to the resource record sets collection location - Href *string `json:"href,omitempty"` + Href string `json:"href"` AdditionalProperties map[string]interface{} } @@ -30,8 +31,9 @@ type _Collection Collection // 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 NewCollection() *Collection { +func NewCollection(href string) *Collection { this := Collection{} + this.Href = href return &this } @@ -43,36 +45,28 @@ func NewCollectionWithDefaults() *Collection { return &this } -// GetHref returns the Href field value if set, zero value otherwise. +// GetHref returns the Href field value func (o *Collection) GetHref() string { - if o == nil || IsNil(o.Href) { + if o == nil { var ret string return ret } - return *o.Href + + return o.Href } -// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// GetHrefOk returns a tuple with the Href field value // and a boolean to check if the value has been set. func (o *Collection) GetHrefOk() (*string, bool) { - if o == nil || IsNil(o.Href) { + if o == nil { return nil, false } - return o.Href, true -} - -// HasHref returns a boolean if a field has been set. -func (o *Collection) HasHref() bool { - if o != nil && !IsNil(o.Href) { - return true - } - - return false + return &o.Href, true } -// SetHref gets a reference to the given string and assigns it to the Href field. +// SetHref sets field value func (o *Collection) SetHref(v string) { - o.Href = &v + o.Href = v } func (o Collection) MarshalJSON() ([]byte, error) { @@ -85,9 +79,7 @@ func (o Collection) MarshalJSON() ([]byte, error) { func (o Collection) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Href) { - toSerialize["href"] = o.Href - } + toSerialize["href"] = o.Href for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -97,6 +89,27 @@ func (o Collection) ToMap() (map[string]interface{}, error) { } func (o *Collection) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "href", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + varCollection := _Collection{} err = json.Unmarshal(data, &varCollection) diff --git a/dns/model_get_resource_record_set_list_ld_result.go b/dns/model_get_resource_record_set_list_ld_result.go index e74eda5..7331f02 100644 --- a/dns/model_get_resource_record_set_list_ld_result.go +++ b/dns/model_get_resource_record_set_list_ld_result.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the GetResourceRecordSetListLdResult type satisfies the MappedNullable interface at compile time @@ -21,9 +22,9 @@ var _ MappedNullable = &GetResourceRecordSetListLdResult{} type GetResourceRecordSetListLdResult struct { // Optional additional information InfoMessage *string `json:"infoMessage,omitempty"` - Links *Links `json:"_links,omitempty"` + Links Links `json:"_links"` // Array of resource record sets - ResourceRecordSets []LdResourceRecordSetDetails `json:"resourceRecordSets,omitempty"` + ResourceRecordSets []LdResourceRecordSetDetails `json:"resourceRecordSets"` AdditionalProperties map[string]interface{} } @@ -33,8 +34,10 @@ type _GetResourceRecordSetListLdResult GetResourceRecordSetListLdResult // 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 NewGetResourceRecordSetListLdResult() *GetResourceRecordSetListLdResult { +func NewGetResourceRecordSetListLdResult(links Links, resourceRecordSets []LdResourceRecordSetDetails) *GetResourceRecordSetListLdResult { this := GetResourceRecordSetListLdResult{} + this.Links = links + this.ResourceRecordSets = resourceRecordSets return &this } @@ -78,66 +81,50 @@ func (o *GetResourceRecordSetListLdResult) SetInfoMessage(v string) { o.InfoMessage = &v } -// GetLinks returns the Links field value if set, zero value otherwise. +// GetLinks returns the Links field value func (o *GetResourceRecordSetListLdResult) GetLinks() Links { - if o == nil || IsNil(o.Links) { + if o == nil { var ret Links return ret } - return *o.Links + + return o.Links } -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// GetLinksOk returns a tuple with the Links field value // and a boolean to check if the value has been set. func (o *GetResourceRecordSetListLdResult) GetLinksOk() (*Links, bool) { - if o == nil || IsNil(o.Links) { + if o == nil { return nil, false } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *GetResourceRecordSetListLdResult) HasLinks() bool { - if o != nil && !IsNil(o.Links) { - return true - } - - return false + return &o.Links, true } -// SetLinks gets a reference to the given Links and assigns it to the Links field. +// SetLinks sets field value func (o *GetResourceRecordSetListLdResult) SetLinks(v Links) { - o.Links = &v + o.Links = v } -// GetResourceRecordSets returns the ResourceRecordSets field value if set, zero value otherwise. +// GetResourceRecordSets returns the ResourceRecordSets field value func (o *GetResourceRecordSetListLdResult) GetResourceRecordSets() []LdResourceRecordSetDetails { - if o == nil || IsNil(o.ResourceRecordSets) { + if o == nil { var ret []LdResourceRecordSetDetails return ret } + return o.ResourceRecordSets } -// GetResourceRecordSetsOk returns a tuple with the ResourceRecordSets field value if set, nil otherwise +// GetResourceRecordSetsOk returns a tuple with the ResourceRecordSets field value // and a boolean to check if the value has been set. func (o *GetResourceRecordSetListLdResult) GetResourceRecordSetsOk() ([]LdResourceRecordSetDetails, bool) { - if o == nil || IsNil(o.ResourceRecordSets) { + if o == nil { return nil, false } return o.ResourceRecordSets, true } -// HasResourceRecordSets returns a boolean if a field has been set. -func (o *GetResourceRecordSetListLdResult) HasResourceRecordSets() bool { - if o != nil && !IsNil(o.ResourceRecordSets) { - return true - } - - return false -} - -// SetResourceRecordSets gets a reference to the given []LdResourceRecordSetDetails and assigns it to the ResourceRecordSets field. +// SetResourceRecordSets sets field value func (o *GetResourceRecordSetListLdResult) SetResourceRecordSets(v []LdResourceRecordSetDetails) { o.ResourceRecordSets = v } @@ -155,12 +142,8 @@ func (o GetResourceRecordSetListLdResult) ToMap() (map[string]interface{}, error if !IsNil(o.InfoMessage) { toSerialize["infoMessage"] = o.InfoMessage } - if !IsNil(o.Links) { - toSerialize["_links"] = o.Links - } - if !IsNil(o.ResourceRecordSets) { - toSerialize["resourceRecordSets"] = o.ResourceRecordSets - } + toSerialize["_links"] = o.Links + toSerialize["resourceRecordSets"] = o.ResourceRecordSets for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -170,6 +153,28 @@ func (o GetResourceRecordSetListLdResult) ToMap() (map[string]interface{}, error } func (o *GetResourceRecordSetListLdResult) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "_links", + "resourceRecordSets", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + varGetResourceRecordSetListLdResult := _GetResourceRecordSetListLdResult{} err = json.Unmarshal(data, &varGetResourceRecordSetListLdResult) diff --git a/dns/model_get_resource_record_set_list_result.go b/dns/model_get_resource_record_set_list_result.go index 51f93aa..76514fc 100644 --- a/dns/model_get_resource_record_set_list_result.go +++ b/dns/model_get_resource_record_set_list_result.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the GetResourceRecordSetListResult type satisfies the MappedNullable interface at compile time @@ -21,9 +22,9 @@ var _ MappedNullable = &GetResourceRecordSetListResult{} type GetResourceRecordSetListResult struct { // Optional additional information InfoMessage *string `json:"infoMessage,omitempty"` - Links *Links `json:"_links,omitempty"` + Links Links `json:"_links"` // Array of resource record sets - ResourceRecordSets []ResourceRecordSetDetails `json:"resourceRecordSets,omitempty"` + ResourceRecordSets []ResourceRecordSetDetails `json:"resourceRecordSets"` AdditionalProperties map[string]interface{} } @@ -33,8 +34,10 @@ type _GetResourceRecordSetListResult GetResourceRecordSetListResult // 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 NewGetResourceRecordSetListResult() *GetResourceRecordSetListResult { +func NewGetResourceRecordSetListResult(links Links, resourceRecordSets []ResourceRecordSetDetails) *GetResourceRecordSetListResult { this := GetResourceRecordSetListResult{} + this.Links = links + this.ResourceRecordSets = resourceRecordSets return &this } @@ -78,66 +81,50 @@ func (o *GetResourceRecordSetListResult) SetInfoMessage(v string) { o.InfoMessage = &v } -// GetLinks returns the Links field value if set, zero value otherwise. +// GetLinks returns the Links field value func (o *GetResourceRecordSetListResult) GetLinks() Links { - if o == nil || IsNil(o.Links) { + if o == nil { var ret Links return ret } - return *o.Links + + return o.Links } -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// GetLinksOk returns a tuple with the Links field value // and a boolean to check if the value has been set. func (o *GetResourceRecordSetListResult) GetLinksOk() (*Links, bool) { - if o == nil || IsNil(o.Links) { + if o == nil { return nil, false } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *GetResourceRecordSetListResult) HasLinks() bool { - if o != nil && !IsNil(o.Links) { - return true - } - - return false + return &o.Links, true } -// SetLinks gets a reference to the given Links and assigns it to the Links field. +// SetLinks sets field value func (o *GetResourceRecordSetListResult) SetLinks(v Links) { - o.Links = &v + o.Links = v } -// GetResourceRecordSets returns the ResourceRecordSets field value if set, zero value otherwise. +// GetResourceRecordSets returns the ResourceRecordSets field value func (o *GetResourceRecordSetListResult) GetResourceRecordSets() []ResourceRecordSetDetails { - if o == nil || IsNil(o.ResourceRecordSets) { + if o == nil { var ret []ResourceRecordSetDetails return ret } + return o.ResourceRecordSets } -// GetResourceRecordSetsOk returns a tuple with the ResourceRecordSets field value if set, nil otherwise +// GetResourceRecordSetsOk returns a tuple with the ResourceRecordSets field value // and a boolean to check if the value has been set. func (o *GetResourceRecordSetListResult) GetResourceRecordSetsOk() ([]ResourceRecordSetDetails, bool) { - if o == nil || IsNil(o.ResourceRecordSets) { + if o == nil { return nil, false } return o.ResourceRecordSets, true } -// HasResourceRecordSets returns a boolean if a field has been set. -func (o *GetResourceRecordSetListResult) HasResourceRecordSets() bool { - if o != nil && !IsNil(o.ResourceRecordSets) { - return true - } - - return false -} - -// SetResourceRecordSets gets a reference to the given []ResourceRecordSetDetails and assigns it to the ResourceRecordSets field. +// SetResourceRecordSets sets field value func (o *GetResourceRecordSetListResult) SetResourceRecordSets(v []ResourceRecordSetDetails) { o.ResourceRecordSets = v } @@ -155,12 +142,8 @@ func (o GetResourceRecordSetListResult) ToMap() (map[string]interface{}, error) if !IsNil(o.InfoMessage) { toSerialize["infoMessage"] = o.InfoMessage } - if !IsNil(o.Links) { - toSerialize["_links"] = o.Links - } - if !IsNil(o.ResourceRecordSets) { - toSerialize["resourceRecordSets"] = o.ResourceRecordSets - } + toSerialize["_links"] = o.Links + toSerialize["resourceRecordSets"] = o.ResourceRecordSets for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -170,6 +153,28 @@ func (o GetResourceRecordSetListResult) ToMap() (map[string]interface{}, error) } func (o *GetResourceRecordSetListResult) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "_links", + "resourceRecordSets", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + varGetResourceRecordSetListResult := _GetResourceRecordSetListResult{} err = json.Unmarshal(data, &varGetResourceRecordSetListResult) diff --git a/dns/model_ld_links.go b/dns/model_ld_links.go index 8ed8059..38d1df8 100644 --- a/dns/model_ld_links.go +++ b/dns/model_ld_links.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the LdLinks type satisfies the MappedNullable interface at compile time @@ -19,8 +20,8 @@ var _ MappedNullable = &LdLinks{} // LdLinks Links to related resource locations type LdLinks struct { - Self *Self `json:"self,omitempty"` - Collection *Collection `json:"collection,omitempty"` + Self Self `json:"self"` + Collection Collection `json:"collection"` AdditionalProperties map[string]interface{} } @@ -30,8 +31,10 @@ type _LdLinks LdLinks // 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 NewLdLinks() *LdLinks { +func NewLdLinks(self Self, collection Collection) *LdLinks { this := LdLinks{} + this.Self = self + this.Collection = collection return &this } @@ -43,68 +46,52 @@ func NewLdLinksWithDefaults() *LdLinks { return &this } -// GetSelf returns the Self field value if set, zero value otherwise. +// GetSelf returns the Self field value func (o *LdLinks) GetSelf() Self { - if o == nil || IsNil(o.Self) { + if o == nil { var ret Self return ret } - return *o.Self + + return o.Self } -// GetSelfOk returns a tuple with the Self field value if set, nil otherwise +// GetSelfOk returns a tuple with the Self field value // and a boolean to check if the value has been set. func (o *LdLinks) GetSelfOk() (*Self, bool) { - if o == nil || IsNil(o.Self) { + if o == nil { return nil, false } - return o.Self, true -} - -// HasSelf returns a boolean if a field has been set. -func (o *LdLinks) HasSelf() bool { - if o != nil && !IsNil(o.Self) { - return true - } - - return false + return &o.Self, true } -// SetSelf gets a reference to the given Self and assigns it to the Self field. +// SetSelf sets field value func (o *LdLinks) SetSelf(v Self) { - o.Self = &v + o.Self = v } -// GetCollection returns the Collection field value if set, zero value otherwise. +// GetCollection returns the Collection field value func (o *LdLinks) GetCollection() Collection { - if o == nil || IsNil(o.Collection) { + if o == nil { var ret Collection return ret } - return *o.Collection + + return o.Collection } -// GetCollectionOk returns a tuple with the Collection field value if set, nil otherwise +// GetCollectionOk returns a tuple with the Collection field value // and a boolean to check if the value has been set. func (o *LdLinks) GetCollectionOk() (*Collection, bool) { - if o == nil || IsNil(o.Collection) { + if o == nil { return nil, false } - return o.Collection, true + return &o.Collection, true } -// HasCollection returns a boolean if a field has been set. -func (o *LdLinks) HasCollection() bool { - if o != nil && !IsNil(o.Collection) { - return true - } - - return false -} - -// SetCollection gets a reference to the given Collection and assigns it to the Collection field. +// SetCollection sets field value func (o *LdLinks) SetCollection(v Collection) { - o.Collection = &v + o.Collection = v } func (o LdLinks) MarshalJSON() ([]byte, error) { @@ -117,12 +104,8 @@ func (o LdLinks) MarshalJSON() ([]byte, error) { func (o LdLinks) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Self) { - toSerialize["self"] = o.Self - } - if !IsNil(o.Collection) { - toSerialize["collection"] = o.Collection - } + toSerialize["self"] = o.Self + toSerialize["collection"] = o.Collection for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -132,6 +115,28 @@ func (o LdLinks) ToMap() (map[string]interface{}, error) { } func (o *LdLinks) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "self", + "collection", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + varLdLinks := _LdLinks{} err = json.Unmarshal(data, &varLdLinks) diff --git a/dns/model_ld_resource_record_set_details.go b/dns/model_ld_resource_record_set_details.go index f8e3207..004ac33 100644 --- a/dns/model_ld_resource_record_set_details.go +++ b/dns/model_ld_resource_record_set_details.go @@ -27,7 +27,7 @@ type LdResourceRecordSetDetails struct { Ttl Ttl `json:"ttl"` // May the set be edited Editable bool `json:"editable"` - Links *LdLinks `json:"_links,omitempty"` + Links LdLinks `json:"_links"` AdditionalProperties map[string]interface{} } @@ -37,13 +37,14 @@ type _LdResourceRecordSetDetails LdResourceRecordSetDetails // 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 NewLdResourceRecordSetDetails(name string, type_ LdResourceRecordSetType, geoContent GeoContent, ttl Ttl, editable bool) *LdResourceRecordSetDetails { +func NewLdResourceRecordSetDetails(name string, type_ LdResourceRecordSetType, geoContent GeoContent, ttl Ttl, editable bool, links LdLinks) *LdResourceRecordSetDetails { this := LdResourceRecordSetDetails{} this.Name = name this.Type = type_ this.GeoContent = geoContent this.Ttl = ttl this.Editable = editable + this.Links = links return &this } @@ -175,36 +176,28 @@ func (o *LdResourceRecordSetDetails) SetEditable(v bool) { o.Editable = v } -// GetLinks returns the Links field value if set, zero value otherwise. +// GetLinks returns the Links field value func (o *LdResourceRecordSetDetails) GetLinks() LdLinks { - if o == nil || IsNil(o.Links) { + if o == nil { var ret LdLinks return ret } - return *o.Links + + return o.Links } -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// GetLinksOk returns a tuple with the Links field value // and a boolean to check if the value has been set. func (o *LdResourceRecordSetDetails) GetLinksOk() (*LdLinks, bool) { - if o == nil || IsNil(o.Links) { + if o == nil { return nil, false } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *LdResourceRecordSetDetails) HasLinks() bool { - if o != nil && !IsNil(o.Links) { - return true - } - - return false + return &o.Links, true } -// SetLinks gets a reference to the given LdLinks and assigns it to the Links field. +// SetLinks sets field value func (o *LdResourceRecordSetDetails) SetLinks(v LdLinks) { - o.Links = &v + o.Links = v } func (o LdResourceRecordSetDetails) MarshalJSON() ([]byte, error) { @@ -222,9 +215,7 @@ func (o LdResourceRecordSetDetails) ToMap() (map[string]interface{}, error) { toSerialize["geoContent"] = o.GeoContent toSerialize["ttl"] = o.Ttl toSerialize["editable"] = o.Editable - if !IsNil(o.Links) { - toSerialize["_links"] = o.Links - } + toSerialize["_links"] = o.Links for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -243,6 +234,7 @@ func (o *LdResourceRecordSetDetails) UnmarshalJSON(data []byte) (err error) { "geoContent", "ttl", "editable", + "_links", } allProperties := make(map[string]interface{}) diff --git a/dns/model_links.go b/dns/model_links.go index 9a307df..efb08eb 100644 --- a/dns/model_links.go +++ b/dns/model_links.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the Links type satisfies the MappedNullable interface at compile time @@ -19,9 +20,9 @@ var _ MappedNullable = &Links{} // Links Links to related resource locations type Links struct { - Self *Self `json:"self,omitempty"` - Parent *Parent `json:"parent,omitempty"` - ValidateSet *ValidateSet `json:"validateSet,omitempty"` + Self Self `json:"self"` + Parent Parent `json:"parent"` + ValidateSet ValidateSet `json:"validateSet"` AdditionalProperties map[string]interface{} } @@ -31,8 +32,11 @@ type _Links Links // 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 NewLinks() *Links { +func NewLinks(self Self, parent Parent, validateSet ValidateSet) *Links { this := Links{} + this.Self = self + this.Parent = parent + this.ValidateSet = validateSet return &this } @@ -44,100 +48,76 @@ func NewLinksWithDefaults() *Links { return &this } -// GetSelf returns the Self field value if set, zero value otherwise. +// GetSelf returns the Self field value func (o *Links) GetSelf() Self { - if o == nil || IsNil(o.Self) { + if o == nil { var ret Self return ret } - return *o.Self + + return o.Self } -// GetSelfOk returns a tuple with the Self field value if set, nil otherwise +// GetSelfOk returns a tuple with the Self field value // and a boolean to check if the value has been set. func (o *Links) GetSelfOk() (*Self, bool) { - if o == nil || IsNil(o.Self) { + if o == nil { return nil, false } - return o.Self, true + return &o.Self, true } -// HasSelf returns a boolean if a field has been set. -func (o *Links) HasSelf() bool { - if o != nil && !IsNil(o.Self) { - return true - } - - return false -} - -// SetSelf gets a reference to the given Self and assigns it to the Self field. +// SetSelf sets field value func (o *Links) SetSelf(v Self) { - o.Self = &v + o.Self = v } -// GetParent returns the Parent field value if set, zero value otherwise. +// GetParent returns the Parent field value func (o *Links) GetParent() Parent { - if o == nil || IsNil(o.Parent) { + if o == nil { var ret Parent return ret } - return *o.Parent + + return o.Parent } -// GetParentOk returns a tuple with the Parent field value if set, nil otherwise +// GetParentOk returns a tuple with the Parent field value // and a boolean to check if the value has been set. func (o *Links) GetParentOk() (*Parent, bool) { - if o == nil || IsNil(o.Parent) { + if o == nil { return nil, false } - return o.Parent, true -} - -// HasParent returns a boolean if a field has been set. -func (o *Links) HasParent() bool { - if o != nil && !IsNil(o.Parent) { - return true - } - - return false + return &o.Parent, true } -// SetParent gets a reference to the given Parent and assigns it to the Parent field. +// SetParent sets field value func (o *Links) SetParent(v Parent) { - o.Parent = &v + o.Parent = v } -// GetValidateSet returns the ValidateSet field value if set, zero value otherwise. +// GetValidateSet returns the ValidateSet field value func (o *Links) GetValidateSet() ValidateSet { - if o == nil || IsNil(o.ValidateSet) { + if o == nil { var ret ValidateSet return ret } - return *o.ValidateSet + + return o.ValidateSet } -// GetValidateSetOk returns a tuple with the ValidateSet field value if set, nil otherwise +// GetValidateSetOk returns a tuple with the ValidateSet field value // and a boolean to check if the value has been set. func (o *Links) GetValidateSetOk() (*ValidateSet, bool) { - if o == nil || IsNil(o.ValidateSet) { + if o == nil { return nil, false } - return o.ValidateSet, true + return &o.ValidateSet, true } -// HasValidateSet returns a boolean if a field has been set. -func (o *Links) HasValidateSet() bool { - if o != nil && !IsNil(o.ValidateSet) { - return true - } - - return false -} - -// SetValidateSet gets a reference to the given ValidateSet and assigns it to the ValidateSet field. +// SetValidateSet sets field value func (o *Links) SetValidateSet(v ValidateSet) { - o.ValidateSet = &v + o.ValidateSet = v } func (o Links) MarshalJSON() ([]byte, error) { @@ -150,15 +130,9 @@ func (o Links) MarshalJSON() ([]byte, error) { func (o Links) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Self) { - toSerialize["self"] = o.Self - } - if !IsNil(o.Parent) { - toSerialize["parent"] = o.Parent - } - if !IsNil(o.ValidateSet) { - toSerialize["validateSet"] = o.ValidateSet - } + toSerialize["self"] = o.Self + toSerialize["parent"] = o.Parent + toSerialize["validateSet"] = o.ValidateSet for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -168,6 +142,29 @@ func (o Links) ToMap() (map[string]interface{}, error) { } func (o *Links) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "self", + "parent", + "validateSet", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + varLinks := _Links{} err = json.Unmarshal(data, &varLinks) diff --git a/dns/model_parent.go b/dns/model_parent.go index d5dd594..db06a1c 100644 --- a/dns/model_parent.go +++ b/dns/model_parent.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the Parent type satisfies the MappedNullable interface at compile time @@ -20,7 +21,7 @@ var _ MappedNullable = &Parent{} // Parent Link to the parent resource type Parent struct { // Hyperlink to the parent resource location - Href *string `json:"href,omitempty"` + Href string `json:"href"` AdditionalProperties map[string]interface{} } @@ -30,8 +31,9 @@ type _Parent Parent // 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 NewParent() *Parent { +func NewParent(href string) *Parent { this := Parent{} + this.Href = href return &this } @@ -43,36 +45,28 @@ func NewParentWithDefaults() *Parent { return &this } -// GetHref returns the Href field value if set, zero value otherwise. +// GetHref returns the Href field value func (o *Parent) GetHref() string { - if o == nil || IsNil(o.Href) { + if o == nil { var ret string return ret } - return *o.Href + + return o.Href } -// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// GetHrefOk returns a tuple with the Href field value // and a boolean to check if the value has been set. func (o *Parent) GetHrefOk() (*string, bool) { - if o == nil || IsNil(o.Href) { + if o == nil { return nil, false } - return o.Href, true -} - -// HasHref returns a boolean if a field has been set. -func (o *Parent) HasHref() bool { - if o != nil && !IsNil(o.Href) { - return true - } - - return false + return &o.Href, true } -// SetHref gets a reference to the given string and assigns it to the Href field. +// SetHref sets field value func (o *Parent) SetHref(v string) { - o.Href = &v + o.Href = v } func (o Parent) MarshalJSON() ([]byte, error) { @@ -85,9 +79,7 @@ func (o Parent) MarshalJSON() ([]byte, error) { func (o Parent) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Href) { - toSerialize["href"] = o.Href - } + toSerialize["href"] = o.Href for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -97,6 +89,27 @@ func (o Parent) ToMap() (map[string]interface{}, error) { } func (o *Parent) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "href", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + varParent := _Parent{} err = json.Unmarshal(data, &varParent) diff --git a/dns/model_resource_record_set_details.go b/dns/model_resource_record_set_details.go index 6d99635..9ae2462 100644 --- a/dns/model_resource_record_set_details.go +++ b/dns/model_resource_record_set_details.go @@ -28,7 +28,7 @@ type ResourceRecordSetDetails struct { Ttl Ttl `json:"ttl"` // May the set be edited Editable bool `json:"editable"` - Links *LdLinks `json:"_links,omitempty"` + Links LdLinks `json:"_links"` AdditionalProperties map[string]interface{} } @@ -38,13 +38,14 @@ type _ResourceRecordSetDetails ResourceRecordSetDetails // 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 NewResourceRecordSetDetails(name string, type_ ResourceRecordSetType, content []string, ttl Ttl, editable bool) *ResourceRecordSetDetails { +func NewResourceRecordSetDetails(name string, type_ ResourceRecordSetType, content []string, ttl Ttl, editable bool, links LdLinks) *ResourceRecordSetDetails { this := ResourceRecordSetDetails{} this.Name = name this.Type = type_ this.Content = content this.Ttl = ttl this.Editable = editable + this.Links = links return &this } @@ -176,36 +177,28 @@ func (o *ResourceRecordSetDetails) SetEditable(v bool) { o.Editable = v } -// GetLinks returns the Links field value if set, zero value otherwise. +// GetLinks returns the Links field value func (o *ResourceRecordSetDetails) GetLinks() LdLinks { - if o == nil || IsNil(o.Links) { + if o == nil { var ret LdLinks return ret } - return *o.Links + + return o.Links } -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// GetLinksOk returns a tuple with the Links field value // and a boolean to check if the value has been set. func (o *ResourceRecordSetDetails) GetLinksOk() (*LdLinks, bool) { - if o == nil || IsNil(o.Links) { + if o == nil { return nil, false } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *ResourceRecordSetDetails) HasLinks() bool { - if o != nil && !IsNil(o.Links) { - return true - } - - return false + return &o.Links, true } -// SetLinks gets a reference to the given LdLinks and assigns it to the Links field. +// SetLinks sets field value func (o *ResourceRecordSetDetails) SetLinks(v LdLinks) { - o.Links = &v + o.Links = v } func (o ResourceRecordSetDetails) MarshalJSON() ([]byte, error) { @@ -223,9 +216,7 @@ func (o ResourceRecordSetDetails) ToMap() (map[string]interface{}, error) { toSerialize["content"] = o.Content toSerialize["ttl"] = o.Ttl toSerialize["editable"] = o.Editable - if !IsNil(o.Links) { - toSerialize["_links"] = o.Links - } + toSerialize["_links"] = o.Links for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -244,6 +235,7 @@ func (o *ResourceRecordSetDetails) UnmarshalJSON(data []byte) (err error) { "content", "ttl", "editable", + "_links", } allProperties := make(map[string]interface{}) diff --git a/dns/model_self.go b/dns/model_self.go index 69b2b51..ec12697 100644 --- a/dns/model_self.go +++ b/dns/model_self.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the Self type satisfies the MappedNullable interface at compile time @@ -20,7 +21,7 @@ var _ MappedNullable = &Self{} // Self Link to the resource record set resource type Self struct { // Hyperlink to the resource record set's location - Href *string `json:"href,omitempty"` + Href string `json:"href"` AdditionalProperties map[string]interface{} } @@ -30,8 +31,9 @@ type _Self Self // 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 NewSelf() *Self { +func NewSelf(href string) *Self { this := Self{} + this.Href = href return &this } @@ -43,36 +45,28 @@ func NewSelfWithDefaults() *Self { return &this } -// GetHref returns the Href field value if set, zero value otherwise. +// GetHref returns the Href field value func (o *Self) GetHref() string { - if o == nil || IsNil(o.Href) { + if o == nil { var ret string return ret } - return *o.Href + + return o.Href } -// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// GetHrefOk returns a tuple with the Href field value // and a boolean to check if the value has been set. func (o *Self) GetHrefOk() (*string, bool) { - if o == nil || IsNil(o.Href) { + if o == nil { return nil, false } - return o.Href, true -} - -// HasHref returns a boolean if a field has been set. -func (o *Self) HasHref() bool { - if o != nil && !IsNil(o.Href) { - return true - } - - return false + return &o.Href, true } -// SetHref gets a reference to the given string and assigns it to the Href field. +// SetHref sets field value func (o *Self) SetHref(v string) { - o.Href = &v + o.Href = v } func (o Self) MarshalJSON() ([]byte, error) { @@ -85,9 +79,7 @@ func (o Self) MarshalJSON() ([]byte, error) { func (o Self) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Href) { - toSerialize["href"] = o.Href - } + toSerialize["href"] = o.Href for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -97,6 +89,27 @@ func (o Self) ToMap() (map[string]interface{}, error) { } func (o *Self) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "href", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + varSelf := _Self{} err = json.Unmarshal(data, &varSelf) diff --git a/dns/model_validate_set.go b/dns/model_validate_set.go index 912ef13..7c8879a 100644 --- a/dns/model_validate_set.go +++ b/dns/model_validate_set.go @@ -12,6 +12,7 @@ package dns import ( "encoding/json" + "fmt" ) // checks if the ValidateSet type satisfies the MappedNullable interface at compile time @@ -20,7 +21,7 @@ var _ MappedNullable = &ValidateSet{} // ValidateSet Link to validate a single resource record set type ValidateSet struct { // Hyperlink to validate a single resource record set for a domain - Href *string `json:"href,omitempty"` + Href string `json:"href"` AdditionalProperties map[string]interface{} } @@ -30,8 +31,9 @@ type _ValidateSet ValidateSet // 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 NewValidateSet() *ValidateSet { +func NewValidateSet(href string) *ValidateSet { this := ValidateSet{} + this.Href = href return &this } @@ -43,36 +45,28 @@ func NewValidateSetWithDefaults() *ValidateSet { return &this } -// GetHref returns the Href field value if set, zero value otherwise. +// GetHref returns the Href field value func (o *ValidateSet) GetHref() string { - if o == nil || IsNil(o.Href) { + if o == nil { var ret string return ret } - return *o.Href + + return o.Href } -// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// GetHrefOk returns a tuple with the Href field value // and a boolean to check if the value has been set. func (o *ValidateSet) GetHrefOk() (*string, bool) { - if o == nil || IsNil(o.Href) { + if o == nil { return nil, false } - return o.Href, true -} - -// HasHref returns a boolean if a field has been set. -func (o *ValidateSet) HasHref() bool { - if o != nil && !IsNil(o.Href) { - return true - } - - return false + return &o.Href, true } -// SetHref gets a reference to the given string and assigns it to the Href field. +// SetHref sets field value func (o *ValidateSet) SetHref(v string) { - o.Href = &v + o.Href = v } func (o ValidateSet) MarshalJSON() ([]byte, error) { @@ -85,9 +79,7 @@ func (o ValidateSet) MarshalJSON() ([]byte, error) { func (o ValidateSet) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Href) { - toSerialize["href"] = o.Href - } + toSerialize["href"] = o.Href for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -97,6 +89,27 @@ func (o ValidateSet) ToMap() (map[string]interface{}, error) { } func (o *ValidateSet) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "href", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + varValidateSet := _ValidateSet{} err = json.Unmarshal(data, &varValidateSet)