diff --git a/Makefile b/Makefile index cb3f50eada..8dd108e961 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,15 @@ build: $(EXEC) go mod tidy $(EXEC) goimports -w . +# Build without fetching a new version of openapi.yaml from netbox-docker +.PHONY: build +build: + $(EXEC) ./scripts/set-versions.sh $(NETBOX_VERSION) $(NETBOX_DOCKER_VERSION) + $(EXEC) ./scripts/fix-spec.py + ./scripts/generate-code.sh + $(EXEC) go mod tidy + $(EXEC) goimports -w . + .PHONY: test test: $(EXEC) go test -v ./... diff --git a/api/openapi.yaml b/api/openapi.yaml index 591c50b2e4..4409bb6e2d 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -105936,7 +105936,6 @@ components: format: int64 readOnly: true required: - - device_count - display - id - name @@ -105993,7 +105992,6 @@ components: format: int64 readOnly: true required: - - device_count - display - id - manufacturer @@ -106865,7 +106863,6 @@ components: format: int64 readOnly: true required: - - device_count - display - id - name @@ -107258,7 +107255,6 @@ components: format: int64 readOnly: true required: - - device_count - display - id - name @@ -109543,7 +109539,6 @@ components: readOnly: true required: - created - - device_count - display - display_url - id @@ -113079,7 +113074,6 @@ components: readOnly: true required: - created - - device_count - display - display_url - id @@ -113337,7 +113331,6 @@ components: - console_server_port_template_count - created - device_bay_template_count - - device_count - display - display_url - front_port_template_count @@ -122378,7 +122371,6 @@ components: required: - _depth - created - - device_count - display - display_url - id @@ -136602,7 +136594,6 @@ components: readOnly: true required: - created - - device_count - display - display_url - id @@ -141339,7 +141330,6 @@ components: readOnly: true required: - created - - device_count - display - display_url - id @@ -144073,7 +144063,6 @@ components: required: - circuit_count - created - - device_count - display - display_url - id @@ -144531,7 +144520,6 @@ components: - circuit_count - cluster_count - created - - device_count - display - display_url - id diff --git a/docs/BriefDeviceRole.md b/docs/BriefDeviceRole.md index 462f3ae197..8e93e7427d 100644 --- a/docs/BriefDeviceRole.md +++ b/docs/BriefDeviceRole.md @@ -10,14 +10,14 @@ Name | Type | Description | Notes **Name** | **string** | | **Slug** | **string** | | **Description** | Pointer to **string** | | [optional] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] **VirtualmachineCount** | **int64** | | [readonly] ## Methods ### NewBriefDeviceRole -`func NewBriefDeviceRole(id int32, url string, display string, name string, slug string, deviceCount int64, virtualmachineCount int64, ) *BriefDeviceRole` +`func NewBriefDeviceRole(id int32, url string, display string, name string, slug string, virtualmachineCount int64, ) *BriefDeviceRole` NewBriefDeviceRole instantiates a new BriefDeviceRole object This constructor will assign default values to properties that have it defined, @@ -176,6 +176,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *BriefDeviceRole) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetVirtualmachineCount diff --git a/docs/BriefDeviceType.md b/docs/BriefDeviceType.md index fbf030f1de..edf56ee0cd 100644 --- a/docs/BriefDeviceType.md +++ b/docs/BriefDeviceType.md @@ -11,13 +11,13 @@ Name | Type | Description | Notes **Model** | **string** | | **Slug** | **string** | | **Description** | Pointer to **string** | | [optional] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] ## Methods ### NewBriefDeviceType -`func NewBriefDeviceType(id int32, url string, display string, manufacturer BriefManufacturer, model string, slug string, deviceCount int64, ) *BriefDeviceType` +`func NewBriefDeviceType(id int32, url string, display string, manufacturer BriefManufacturer, model string, slug string, ) *BriefDeviceType` NewBriefDeviceType instantiates a new BriefDeviceType object This constructor will assign default values to properties that have it defined, @@ -196,6 +196,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *BriefDeviceType) HasDeviceCount() bool` + +HasDeviceCount 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/docs/BriefPlatform.md b/docs/BriefPlatform.md index 4f9238f205..3f9a65a5ab 100644 --- a/docs/BriefPlatform.md +++ b/docs/BriefPlatform.md @@ -10,14 +10,14 @@ Name | Type | Description | Notes **Name** | **string** | | **Slug** | **string** | | **Description** | Pointer to **string** | | [optional] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] **VirtualmachineCount** | **int64** | | [readonly] ## Methods ### NewBriefPlatform -`func NewBriefPlatform(id int32, url string, display string, name string, slug string, deviceCount int64, virtualmachineCount int64, ) *BriefPlatform` +`func NewBriefPlatform(id int32, url string, display string, name string, slug string, virtualmachineCount int64, ) *BriefPlatform` NewBriefPlatform instantiates a new BriefPlatform object This constructor will assign default values to properties that have it defined, @@ -176,6 +176,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *BriefPlatform) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetVirtualmachineCount diff --git a/docs/BriefRack.md b/docs/BriefRack.md index 045b88e14f..a3245e2e90 100644 --- a/docs/BriefRack.md +++ b/docs/BriefRack.md @@ -9,13 +9,13 @@ Name | Type | Description | Notes **Display** | **string** | | [readonly] **Name** | **string** | | **Description** | Pointer to **string** | | [optional] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] ## Methods ### NewBriefRack -`func NewBriefRack(id int32, url string, display string, name string, deviceCount int64, ) *BriefRack` +`func NewBriefRack(id int32, url string, display string, name string, ) *BriefRack` NewBriefRack instantiates a new BriefRack object This constructor will assign default values to properties that have it defined, @@ -154,6 +154,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *BriefRack) HasDeviceCount() bool` + +HasDeviceCount 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/docs/Cluster.md b/docs/Cluster.md index 7475d4a4f7..236320d72b 100644 --- a/docs/Cluster.md +++ b/docs/Cluster.md @@ -20,14 +20,14 @@ Name | Type | Description | Notes **CustomFields** | Pointer to **map[string]interface{}** | | [optional] **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] **VirtualmachineCount** | **int64** | | [readonly] ## Methods ### NewCluster -`func NewCluster(id int32, url string, displayUrl string, display string, name string, type_ BriefClusterType, created NullableTime, lastUpdated NullableTime, deviceCount int64, virtualmachineCount int64, ) *Cluster` +`func NewCluster(id int32, url string, displayUrl string, display string, name string, type_ BriefClusterType, created NullableTime, lastUpdated NullableTime, virtualmachineCount int64, ) *Cluster` NewCluster instantiates a new Cluster object This constructor will assign default values to properties that have it defined, @@ -471,6 +471,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *Cluster) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetVirtualmachineCount diff --git a/docs/DeviceRole.md b/docs/DeviceRole.md index 09c12f0f0b..c5002d9a81 100644 --- a/docs/DeviceRole.md +++ b/docs/DeviceRole.md @@ -18,14 +18,14 @@ Name | Type | Description | Notes **CustomFields** | Pointer to **map[string]interface{}** | | [optional] **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] **VirtualmachineCount** | **int64** | | [readonly] ## Methods ### NewDeviceRole -`func NewDeviceRole(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, deviceCount int64, virtualmachineCount int64, ) *DeviceRole` +`func NewDeviceRole(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, virtualmachineCount int64, ) *DeviceRole` NewDeviceRole instantiates a new DeviceRole object This constructor will assign default values to properties that have it defined, @@ -399,6 +399,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *DeviceRole) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetVirtualmachineCount diff --git a/docs/DeviceType.md b/docs/DeviceType.md index ed84f56ec9..9c365a837e 100644 --- a/docs/DeviceType.md +++ b/docs/DeviceType.md @@ -28,7 +28,7 @@ Name | Type | Description | Notes **CustomFields** | Pointer to **map[string]interface{}** | | [optional] **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] **ConsolePortTemplateCount** | **int32** | | [readonly] **ConsoleServerPortTemplateCount** | **int32** | | [readonly] **PowerPortTemplateCount** | **int32** | | [readonly] @@ -44,7 +44,7 @@ Name | Type | Description | Notes ### NewDeviceType -`func NewDeviceType(id int32, url string, displayUrl string, display string, manufacturer BriefManufacturer, model string, slug string, created NullableTime, lastUpdated NullableTime, deviceCount int64, consolePortTemplateCount int32, consoleServerPortTemplateCount int32, powerPortTemplateCount int32, powerOutletTemplateCount int32, interfaceTemplateCount int32, frontPortTemplateCount int32, rearPortTemplateCount int32, deviceBayTemplateCount int32, moduleBayTemplateCount int32, inventoryItemTemplateCount int32, ) *DeviceType` +`func NewDeviceType(id int32, url string, displayUrl string, display string, manufacturer BriefManufacturer, model string, slug string, created NullableTime, lastUpdated NullableTime, consolePortTemplateCount int32, consoleServerPortTemplateCount int32, powerPortTemplateCount int32, powerOutletTemplateCount int32, interfaceTemplateCount int32, frontPortTemplateCount int32, rearPortTemplateCount int32, deviceBayTemplateCount int32, moduleBayTemplateCount int32, inventoryItemTemplateCount int32, ) *DeviceType` NewDeviceType instantiates a new DeviceType object This constructor will assign default values to properties that have it defined, @@ -723,6 +723,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *DeviceType) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetConsolePortTemplateCount diff --git a/docs/Location.md b/docs/Location.md index e911a47c34..e13e7a2982 100644 --- a/docs/Location.md +++ b/docs/Location.md @@ -21,14 +21,14 @@ Name | Type | Description | Notes **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] **RackCount** | **int32** | | [readonly] [default to 0] -**DeviceCount** | **int32** | | [readonly] [default to 0] +**DeviceCount** | Pointer to **int32** | | [optional] [readonly] [default to 0] **Depth** | **int32** | | [readonly] ## Methods ### NewLocation -`func NewLocation(id int32, url string, displayUrl string, display string, name string, slug string, site BriefSite, created NullableTime, lastUpdated NullableTime, rackCount int32, deviceCount int32, depth int32, ) *Location` +`func NewLocation(id int32, url string, displayUrl string, display string, name string, slug string, site BriefSite, created NullableTime, lastUpdated NullableTime, rackCount int32, depth int32, ) *Location` NewLocation instantiates a new Location object This constructor will assign default values to properties that have it defined, @@ -477,6 +477,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *Location) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetDepth diff --git a/docs/Platform.md b/docs/Platform.md index d88f6d620f..8d8046fbf4 100644 --- a/docs/Platform.md +++ b/docs/Platform.md @@ -17,14 +17,14 @@ Name | Type | Description | Notes **CustomFields** | Pointer to **map[string]interface{}** | | [optional] **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] **VirtualmachineCount** | **int64** | | [readonly] ## Methods ### NewPlatform -`func NewPlatform(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, deviceCount int64, virtualmachineCount int64, ) *Platform` +`func NewPlatform(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, virtualmachineCount int64, ) *Platform` NewPlatform instantiates a new Platform object This constructor will assign default values to properties that have it defined, @@ -383,6 +383,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *Platform) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetVirtualmachineCount diff --git a/docs/Rack.md b/docs/Rack.md index 83c1411322..da82287647 100644 --- a/docs/Rack.md +++ b/docs/Rack.md @@ -37,14 +37,14 @@ Name | Type | Description | Notes **CustomFields** | Pointer to **map[string]interface{}** | | [optional] **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] **PowerfeedCount** | **int64** | | [readonly] ## Methods ### NewRack -`func NewRack(id int32, url string, displayUrl string, display string, name string, site BriefSite, created NullableTime, lastUpdated NullableTime, deviceCount int64, powerfeedCount int64, ) *Rack` +`func NewRack(id int32, url string, displayUrl string, display string, name string, site BriefSite, created NullableTime, lastUpdated NullableTime, powerfeedCount int64, ) *Rack` NewRack instantiates a new Rack object This constructor will assign default values to properties that have it defined, @@ -1023,6 +1023,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *Rack) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetPowerfeedCount diff --git a/docs/Site.md b/docs/Site.md index 39600dc6ab..01bbdb8939 100644 --- a/docs/Site.md +++ b/docs/Site.md @@ -28,7 +28,7 @@ Name | Type | Description | Notes **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] **CircuitCount** | **int64** | | [readonly] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] **PrefixCount** | **int64** | | [readonly] **RackCount** | **int64** | | [readonly] **VirtualmachineCount** | **int64** | | [readonly] @@ -38,7 +38,7 @@ Name | Type | Description | Notes ### NewSite -`func NewSite(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, circuitCount int64, deviceCount int64, prefixCount int64, rackCount int64, virtualmachineCount int64, vlanCount int64, ) *Site` +`func NewSite(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, circuitCount int64, prefixCount int64, rackCount int64, virtualmachineCount int64, vlanCount int64, ) *Site` NewSite instantiates a new Site object This constructor will assign default values to properties that have it defined, @@ -707,6 +707,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *Site) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetPrefixCount diff --git a/docs/Tenant.md b/docs/Tenant.md index f06a23a14f..b33fc64730 100644 --- a/docs/Tenant.md +++ b/docs/Tenant.md @@ -18,7 +18,7 @@ Name | Type | Description | Notes **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] **CircuitCount** | **int64** | | [readonly] -**DeviceCount** | **int64** | | [readonly] +**DeviceCount** | Pointer to **int64** | | [optional] [readonly] **IpaddressCount** | **int64** | | [readonly] **PrefixCount** | **int64** | | [readonly] **RackCount** | **int64** | | [readonly] @@ -32,7 +32,7 @@ Name | Type | Description | Notes ### NewTenant -`func NewTenant(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, circuitCount int64, deviceCount int64, ipaddressCount int64, prefixCount int64, rackCount int64, siteCount int64, virtualmachineCount int64, vlanCount int64, vrfCount int64, clusterCount int64, ) *Tenant` +`func NewTenant(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, circuitCount int64, ipaddressCount int64, prefixCount int64, rackCount int64, siteCount int64, virtualmachineCount int64, vlanCount int64, vrfCount int64, clusterCount int64, ) *Tenant` NewTenant instantiates a new Tenant object This constructor will assign default values to properties that have it defined, @@ -401,6 +401,11 @@ and a boolean to check if the value has been set. SetDeviceCount sets DeviceCount field to given value. +### HasDeviceCount + +`func (o *Tenant) HasDeviceCount() bool` + +HasDeviceCount returns a boolean if a field has been set. ### GetIpaddressCount diff --git a/model_brief_device_role.go b/model_brief_device_role.go index ee629f8d67..76b577ef9b 100644 --- a/model_brief_device_role.go +++ b/model_brief_device_role.go @@ -26,7 +26,7 @@ type BriefDeviceRole struct { Name string `json:"name"` Slug string `json:"slug"` Description *string `json:"description,omitempty"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` VirtualmachineCount int64 `json:"virtualmachine_count"` AdditionalProperties map[string]interface{} } @@ -37,14 +37,13 @@ type _BriefDeviceRole BriefDeviceRole // 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 NewBriefDeviceRole(id int32, url string, display string, name string, slug string, deviceCount int64, virtualmachineCount int64) *BriefDeviceRole { +func NewBriefDeviceRole(id int32, url string, display string, name string, slug string, virtualmachineCount int64) *BriefDeviceRole { this := BriefDeviceRole{} this.Id = id this.Url = url this.Display = display this.Name = name this.Slug = slug - this.DeviceCount = deviceCount this.VirtualmachineCount = virtualmachineCount return &this } @@ -209,28 +208,36 @@ func (o *BriefDeviceRole) SetDescription(v string) { o.Description = &v } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *BriefDeviceRole) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BriefDeviceRole) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *BriefDeviceRole) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *BriefDeviceRole) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } // GetVirtualmachineCount returns the VirtualmachineCount field value @@ -275,7 +282,9 @@ func (o BriefDeviceRole) ToMap() (map[string]interface{}, error) { if !IsNil(o.Description) { toSerialize["description"] = o.Description } - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["virtualmachine_count"] = o.VirtualmachineCount for key, value := range o.AdditionalProperties { @@ -295,7 +304,6 @@ func (o *BriefDeviceRole) UnmarshalJSON(data []byte) (err error) { "display", "name", "slug", - "device_count", "virtualmachine_count", } diff --git a/model_brief_device_type.go b/model_brief_device_type.go index 177a2c2126..fc540dd137 100644 --- a/model_brief_device_type.go +++ b/model_brief_device_type.go @@ -27,7 +27,7 @@ type BriefDeviceType struct { Model string `json:"model"` Slug string `json:"slug"` Description *string `json:"description,omitempty"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` AdditionalProperties map[string]interface{} } @@ -37,7 +37,7 @@ type _BriefDeviceType BriefDeviceType // 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 NewBriefDeviceType(id int32, url string, display string, manufacturer BriefManufacturer, model string, slug string, deviceCount int64) *BriefDeviceType { +func NewBriefDeviceType(id int32, url string, display string, manufacturer BriefManufacturer, model string, slug string) *BriefDeviceType { this := BriefDeviceType{} this.Id = id this.Url = url @@ -45,7 +45,6 @@ func NewBriefDeviceType(id int32, url string, display string, manufacturer Brief this.Manufacturer = manufacturer this.Model = model this.Slug = slug - this.DeviceCount = deviceCount return &this } @@ -233,28 +232,36 @@ func (o *BriefDeviceType) SetDescription(v string) { o.Description = &v } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *BriefDeviceType) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BriefDeviceType) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *BriefDeviceType) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *BriefDeviceType) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } func (o BriefDeviceType) MarshalJSON() ([]byte, error) { @@ -276,7 +283,9 @@ func (o BriefDeviceType) ToMap() (map[string]interface{}, error) { if !IsNil(o.Description) { toSerialize["description"] = o.Description } - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -296,7 +305,6 @@ func (o *BriefDeviceType) UnmarshalJSON(data []byte) (err error) { "manufacturer", "model", "slug", - "device_count", } allProperties := make(map[string]interface{}) diff --git a/model_brief_platform.go b/model_brief_platform.go index 4c47461358..a040446ed3 100644 --- a/model_brief_platform.go +++ b/model_brief_platform.go @@ -26,7 +26,7 @@ type BriefPlatform struct { Name string `json:"name"` Slug string `json:"slug"` Description *string `json:"description,omitempty"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` VirtualmachineCount int64 `json:"virtualmachine_count"` AdditionalProperties map[string]interface{} } @@ -37,14 +37,13 @@ type _BriefPlatform BriefPlatform // 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 NewBriefPlatform(id int32, url string, display string, name string, slug string, deviceCount int64, virtualmachineCount int64) *BriefPlatform { +func NewBriefPlatform(id int32, url string, display string, name string, slug string, virtualmachineCount int64) *BriefPlatform { this := BriefPlatform{} this.Id = id this.Url = url this.Display = display this.Name = name this.Slug = slug - this.DeviceCount = deviceCount this.VirtualmachineCount = virtualmachineCount return &this } @@ -209,28 +208,36 @@ func (o *BriefPlatform) SetDescription(v string) { o.Description = &v } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *BriefPlatform) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BriefPlatform) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *BriefPlatform) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *BriefPlatform) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } // GetVirtualmachineCount returns the VirtualmachineCount field value @@ -275,7 +282,9 @@ func (o BriefPlatform) ToMap() (map[string]interface{}, error) { if !IsNil(o.Description) { toSerialize["description"] = o.Description } - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["virtualmachine_count"] = o.VirtualmachineCount for key, value := range o.AdditionalProperties { @@ -295,7 +304,6 @@ func (o *BriefPlatform) UnmarshalJSON(data []byte) (err error) { "display", "name", "slug", - "device_count", "virtualmachine_count", } diff --git a/model_brief_rack.go b/model_brief_rack.go index 27af322ca8..4540f70128 100644 --- a/model_brief_rack.go +++ b/model_brief_rack.go @@ -25,7 +25,7 @@ type BriefRack struct { Display string `json:"display"` Name string `json:"name"` Description *string `json:"description,omitempty"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` AdditionalProperties map[string]interface{} } @@ -35,13 +35,12 @@ type _BriefRack BriefRack // 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 NewBriefRack(id int32, url string, display string, name string, deviceCount int64) *BriefRack { +func NewBriefRack(id int32, url string, display string, name string) *BriefRack { this := BriefRack{} this.Id = id this.Url = url this.Display = display this.Name = name - this.DeviceCount = deviceCount return &this } @@ -181,28 +180,36 @@ func (o *BriefRack) SetDescription(v string) { o.Description = &v } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *BriefRack) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BriefRack) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *BriefRack) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *BriefRack) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } func (o BriefRack) MarshalJSON() ([]byte, error) { @@ -222,7 +229,9 @@ func (o BriefRack) ToMap() (map[string]interface{}, error) { if !IsNil(o.Description) { toSerialize["description"] = o.Description } - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -240,7 +249,6 @@ func (o *BriefRack) UnmarshalJSON(data []byte) (err error) { "url", "display", "name", - "device_count", } allProperties := make(map[string]interface{}) diff --git a/model_cluster.go b/model_cluster.go index 8d73580b00..f09c0677de 100644 --- a/model_cluster.go +++ b/model_cluster.go @@ -37,7 +37,7 @@ type Cluster struct { CustomFields map[string]interface{} `json:"custom_fields,omitempty"` Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` VirtualmachineCount int64 `json:"virtualmachine_count"` AdditionalProperties map[string]interface{} } @@ -48,7 +48,7 @@ type _Cluster Cluster // 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 NewCluster(id int32, url string, displayUrl string, display string, name string, type_ BriefClusterType, created NullableTime, lastUpdated NullableTime, deviceCount int64, virtualmachineCount int64) *Cluster { +func NewCluster(id int32, url string, displayUrl string, display string, name string, type_ BriefClusterType, created NullableTime, lastUpdated NullableTime, virtualmachineCount int64) *Cluster { this := Cluster{} this.Id = id this.Url = url @@ -58,7 +58,6 @@ func NewCluster(id int32, url string, displayUrl string, display string, name st this.Type = type_ this.Created = created this.LastUpdated = lastUpdated - this.DeviceCount = deviceCount this.VirtualmachineCount = virtualmachineCount return &this } @@ -556,28 +555,36 @@ func (o *Cluster) SetLastUpdated(v time.Time) { o.LastUpdated.Set(&v) } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *Cluster) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Cluster) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *Cluster) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *Cluster) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } // GetVirtualmachineCount returns the VirtualmachineCount field value @@ -646,7 +653,9 @@ func (o Cluster) ToMap() (map[string]interface{}, error) { } toSerialize["created"] = o.Created.Get() toSerialize["last_updated"] = o.LastUpdated.Get() - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["virtualmachine_count"] = o.VirtualmachineCount for key, value := range o.AdditionalProperties { @@ -669,7 +678,6 @@ func (o *Cluster) UnmarshalJSON(data []byte) (err error) { "type", "created", "last_updated", - "device_count", "virtualmachine_count", } diff --git a/model_device_role.go b/model_device_role.go index 4644831bf8..51e8e940ad 100644 --- a/model_device_role.go +++ b/model_device_role.go @@ -36,7 +36,7 @@ type DeviceRole struct { CustomFields map[string]interface{} `json:"custom_fields,omitempty"` Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` VirtualmachineCount int64 `json:"virtualmachine_count"` AdditionalProperties map[string]interface{} } @@ -47,7 +47,7 @@ type _DeviceRole DeviceRole // 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 NewDeviceRole(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, deviceCount int64, virtualmachineCount int64) *DeviceRole { +func NewDeviceRole(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, virtualmachineCount int64) *DeviceRole { this := DeviceRole{} this.Id = id this.Url = url @@ -57,7 +57,6 @@ func NewDeviceRole(id int32, url string, displayUrl string, display string, name this.Slug = slug this.Created = created this.LastUpdated = lastUpdated - this.DeviceCount = deviceCount this.VirtualmachineCount = virtualmachineCount return &this } @@ -469,28 +468,36 @@ func (o *DeviceRole) SetLastUpdated(v time.Time) { o.LastUpdated.Set(&v) } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *DeviceRole) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceRole) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *DeviceRole) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *DeviceRole) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } // GetVirtualmachineCount returns the VirtualmachineCount field value @@ -553,7 +560,9 @@ func (o DeviceRole) ToMap() (map[string]interface{}, error) { } toSerialize["created"] = o.Created.Get() toSerialize["last_updated"] = o.LastUpdated.Get() - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["virtualmachine_count"] = o.VirtualmachineCount for key, value := range o.AdditionalProperties { @@ -576,7 +585,6 @@ func (o *DeviceRole) UnmarshalJSON(data []byte) (err error) { "slug", "created", "last_updated", - "device_count", "virtualmachine_count", } diff --git a/model_device_type.go b/model_device_type.go index 4fbb38af6e..afcd735a24 100644 --- a/model_device_type.go +++ b/model_device_type.go @@ -48,7 +48,7 @@ type DeviceType struct { CustomFields map[string]interface{} `json:"custom_fields,omitempty"` Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` ConsolePortTemplateCount int32 `json:"console_port_template_count"` ConsoleServerPortTemplateCount int32 `json:"console_server_port_template_count"` PowerPortTemplateCount int32 `json:"power_port_template_count"` @@ -68,7 +68,7 @@ type _DeviceType DeviceType // 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 NewDeviceType(id int32, url string, displayUrl string, display string, manufacturer BriefManufacturer, model string, slug string, created NullableTime, lastUpdated NullableTime, deviceCount int64, consolePortTemplateCount int32, consoleServerPortTemplateCount int32, powerPortTemplateCount int32, powerOutletTemplateCount int32, interfaceTemplateCount int32, frontPortTemplateCount int32, rearPortTemplateCount int32, deviceBayTemplateCount int32, moduleBayTemplateCount int32, inventoryItemTemplateCount int32) *DeviceType { +func NewDeviceType(id int32, url string, displayUrl string, display string, manufacturer BriefManufacturer, model string, slug string, created NullableTime, lastUpdated NullableTime, consolePortTemplateCount int32, consoleServerPortTemplateCount int32, powerPortTemplateCount int32, powerOutletTemplateCount int32, interfaceTemplateCount int32, frontPortTemplateCount int32, rearPortTemplateCount int32, deviceBayTemplateCount int32, moduleBayTemplateCount int32, inventoryItemTemplateCount int32) *DeviceType { this := DeviceType{} this.Id = id this.Url = url @@ -81,7 +81,6 @@ func NewDeviceType(id int32, url string, displayUrl string, display string, manu this.UHeight = &uHeight this.Created = created this.LastUpdated = lastUpdated - this.DeviceCount = deviceCount this.ConsolePortTemplateCount = consolePortTemplateCount this.ConsoleServerPortTemplateCount = consoleServerPortTemplateCount this.PowerPortTemplateCount = powerPortTemplateCount @@ -882,28 +881,36 @@ func (o *DeviceType) SetLastUpdated(v time.Time) { o.LastUpdated.Set(&v) } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *DeviceType) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceType) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *DeviceType) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *DeviceType) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } // GetConsolePortTemplateCount returns the ConsolePortTemplateCount field value @@ -1210,7 +1217,9 @@ func (o DeviceType) ToMap() (map[string]interface{}, error) { } toSerialize["created"] = o.Created.Get() toSerialize["last_updated"] = o.LastUpdated.Get() - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["console_port_template_count"] = o.ConsolePortTemplateCount toSerialize["console_server_port_template_count"] = o.ConsoleServerPortTemplateCount toSerialize["power_port_template_count"] = o.PowerPortTemplateCount @@ -1243,7 +1252,6 @@ func (o *DeviceType) UnmarshalJSON(data []byte) (err error) { "slug", "created", "last_updated", - "device_count", "console_port_template_count", "console_server_port_template_count", "power_port_template_count", diff --git a/model_location.go b/model_location.go index ef68c012f3..0d54fda222 100644 --- a/model_location.go +++ b/model_location.go @@ -39,7 +39,7 @@ type Location struct { Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` RackCount int32 `json:"rack_count"` - DeviceCount int32 `json:"device_count"` + DeviceCount *int32 `json:"device_count,omitempty"` Depth int32 `json:"_depth"` AdditionalProperties map[string]interface{} } @@ -50,7 +50,7 @@ type _Location Location // 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 NewLocation(id int32, url string, displayUrl string, display string, name string, slug string, site BriefSite, created NullableTime, lastUpdated NullableTime, rackCount int32, deviceCount int32, depth int32) *Location { +func NewLocation(id int32, url string, displayUrl string, display string, name string, slug string, site BriefSite, created NullableTime, lastUpdated NullableTime, rackCount int32, depth int32) *Location { this := Location{} this.Id = id this.Url = url @@ -62,7 +62,6 @@ func NewLocation(id int32, url string, displayUrl string, display string, name s this.Created = created this.LastUpdated = lastUpdated this.RackCount = rackCount - this.DeviceCount = deviceCount this.Depth = depth return &this } @@ -565,28 +564,36 @@ func (o *Location) SetRackCount(v int32) { o.RackCount = v } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *Location) GetDeviceCount() int32 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int32 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Location) GetDeviceCountOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *Location) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int32 and assigns it to the DeviceCount field. func (o *Location) SetDeviceCount(v int32) { - o.DeviceCount = v + o.DeviceCount = &v } // GetDepth returns the Depth field value @@ -654,7 +661,9 @@ func (o Location) ToMap() (map[string]interface{}, error) { toSerialize["created"] = o.Created.Get() toSerialize["last_updated"] = o.LastUpdated.Get() toSerialize["rack_count"] = o.RackCount - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["_depth"] = o.Depth for key, value := range o.AdditionalProperties { @@ -679,7 +688,6 @@ func (o *Location) UnmarshalJSON(data []byte) (err error) { "created", "last_updated", "rack_count", - "device_count", "_depth", } diff --git a/model_platform.go b/model_platform.go index d0c86b87f6..caec878eb2 100644 --- a/model_platform.go +++ b/model_platform.go @@ -34,7 +34,7 @@ type Platform struct { CustomFields map[string]interface{} `json:"custom_fields,omitempty"` Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` VirtualmachineCount int64 `json:"virtualmachine_count"` AdditionalProperties map[string]interface{} } @@ -45,7 +45,7 @@ type _Platform Platform // 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 NewPlatform(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, deviceCount int64, virtualmachineCount int64) *Platform { +func NewPlatform(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, virtualmachineCount int64) *Platform { this := Platform{} this.Id = id this.Url = url @@ -55,7 +55,6 @@ func NewPlatform(id int32, url string, displayUrl string, display string, name s this.Slug = slug this.Created = created this.LastUpdated = lastUpdated - this.DeviceCount = deviceCount this.VirtualmachineCount = virtualmachineCount return &this } @@ -446,28 +445,36 @@ func (o *Platform) SetLastUpdated(v time.Time) { o.LastUpdated.Set(&v) } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *Platform) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Platform) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *Platform) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *Platform) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } // GetVirtualmachineCount returns the VirtualmachineCount field value @@ -527,7 +534,9 @@ func (o Platform) ToMap() (map[string]interface{}, error) { } toSerialize["created"] = o.Created.Get() toSerialize["last_updated"] = o.LastUpdated.Get() - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["virtualmachine_count"] = o.VirtualmachineCount for key, value := range o.AdditionalProperties { @@ -550,7 +559,6 @@ func (o *Platform) UnmarshalJSON(data []byte) (err error) { "slug", "created", "last_updated", - "device_count", "virtualmachine_count", } diff --git a/model_rack.go b/model_rack.go index a57a8f8dfa..52f79e576d 100644 --- a/model_rack.go +++ b/model_rack.go @@ -62,7 +62,7 @@ type Rack struct { CustomFields map[string]interface{} `json:"custom_fields,omitempty"` Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` PowerfeedCount int64 `json:"powerfeed_count"` AdditionalProperties map[string]interface{} } @@ -73,7 +73,7 @@ type _Rack Rack // 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 NewRack(id int32, url string, displayUrl string, display string, name string, site BriefSite, created NullableTime, lastUpdated NullableTime, deviceCount int64, powerfeedCount int64) *Rack { +func NewRack(id int32, url string, displayUrl string, display string, name string, site BriefSite, created NullableTime, lastUpdated NullableTime, powerfeedCount int64) *Rack { this := Rack{} this.Id = id this.Url = url @@ -83,7 +83,6 @@ func NewRack(id int32, url string, displayUrl string, display string, name strin this.Site = site this.Created = created this.LastUpdated = lastUpdated - this.DeviceCount = deviceCount this.PowerfeedCount = powerfeedCount return &this } @@ -1246,28 +1245,36 @@ func (o *Rack) SetLastUpdated(v time.Time) { o.LastUpdated.Set(&v) } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *Rack) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Rack) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *Rack) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *Rack) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } // GetPowerfeedCount returns the PowerfeedCount field value @@ -1387,7 +1394,9 @@ func (o Rack) ToMap() (map[string]interface{}, error) { } toSerialize["created"] = o.Created.Get() toSerialize["last_updated"] = o.LastUpdated.Get() - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["powerfeed_count"] = o.PowerfeedCount for key, value := range o.AdditionalProperties { @@ -1410,7 +1419,6 @@ func (o *Rack) UnmarshalJSON(data []byte) (err error) { "site", "created", "last_updated", - "device_count", "powerfeed_count", } diff --git a/model_site.go b/model_site.go index 9679c7ddf0..81a9b5cc9c 100644 --- a/model_site.go +++ b/model_site.go @@ -51,7 +51,7 @@ type Site struct { Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` CircuitCount int64 `json:"circuit_count"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` PrefixCount int64 `json:"prefix_count"` RackCount int64 `json:"rack_count"` VirtualmachineCount int64 `json:"virtualmachine_count"` @@ -65,7 +65,7 @@ type _Site Site // 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 NewSite(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, circuitCount int64, deviceCount int64, prefixCount int64, rackCount int64, virtualmachineCount int64, vlanCount int64) *Site { +func NewSite(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, circuitCount int64, prefixCount int64, rackCount int64, virtualmachineCount int64, vlanCount int64) *Site { this := Site{} this.Id = id this.Url = url @@ -76,7 +76,6 @@ func NewSite(id int32, url string, displayUrl string, display string, name strin this.Created = created this.LastUpdated = lastUpdated this.CircuitCount = circuitCount - this.DeviceCount = deviceCount this.PrefixCount = prefixCount this.RackCount = rackCount this.VirtualmachineCount = virtualmachineCount @@ -858,28 +857,36 @@ func (o *Site) SetCircuitCount(v int64) { o.CircuitCount = v } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *Site) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Site) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *Site) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *Site) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } // GetPrefixCount returns the PrefixCount field value @@ -1042,7 +1049,9 @@ func (o Site) ToMap() (map[string]interface{}, error) { toSerialize["created"] = o.Created.Get() toSerialize["last_updated"] = o.LastUpdated.Get() toSerialize["circuit_count"] = o.CircuitCount - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["prefix_count"] = o.PrefixCount toSerialize["rack_count"] = o.RackCount toSerialize["virtualmachine_count"] = o.VirtualmachineCount @@ -1069,7 +1078,6 @@ func (o *Site) UnmarshalJSON(data []byte) (err error) { "created", "last_updated", "circuit_count", - "device_count", "prefix_count", "rack_count", "virtualmachine_count", diff --git a/model_tenant.go b/model_tenant.go index b6b4fa0e2f..30111e98f6 100644 --- a/model_tenant.go +++ b/model_tenant.go @@ -35,7 +35,7 @@ type Tenant struct { Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` CircuitCount int64 `json:"circuit_count"` - DeviceCount int64 `json:"device_count"` + DeviceCount *int64 `json:"device_count,omitempty"` IpaddressCount int64 `json:"ipaddress_count"` PrefixCount int64 `json:"prefix_count"` RackCount int64 `json:"rack_count"` @@ -53,7 +53,7 @@ type _Tenant Tenant // 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 NewTenant(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, circuitCount int64, deviceCount int64, ipaddressCount int64, prefixCount int64, rackCount int64, siteCount int64, virtualmachineCount int64, vlanCount int64, vrfCount int64, clusterCount int64) *Tenant { +func NewTenant(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, circuitCount int64, ipaddressCount int64, prefixCount int64, rackCount int64, siteCount int64, virtualmachineCount int64, vlanCount int64, vrfCount int64, clusterCount int64) *Tenant { this := Tenant{} this.Id = id this.Url = url @@ -64,7 +64,6 @@ func NewTenant(id int32, url string, displayUrl string, display string, name str this.Created = created this.LastUpdated = lastUpdated this.CircuitCount = circuitCount - this.DeviceCount = deviceCount this.IpaddressCount = ipaddressCount this.PrefixCount = prefixCount this.RackCount = rackCount @@ -475,28 +474,36 @@ func (o *Tenant) SetCircuitCount(v int64) { o.CircuitCount = v } -// GetDeviceCount returns the DeviceCount field value +// GetDeviceCount returns the DeviceCount field value if set, zero value otherwise. func (o *Tenant) GetDeviceCount() int64 { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { var ret int64 return ret } - - return o.DeviceCount + return *o.DeviceCount } -// GetDeviceCountOk returns a tuple with the DeviceCount field value +// GetDeviceCountOk returns a tuple with the DeviceCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Tenant) GetDeviceCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceCount) { return nil, false } - return &o.DeviceCount, true + return o.DeviceCount, true +} + +// HasDeviceCount returns a boolean if a field has been set. +func (o *Tenant) HasDeviceCount() bool { + if o != nil && !IsNil(o.DeviceCount) { + return true + } + + return false } -// SetDeviceCount sets field value +// SetDeviceCount gets a reference to the given int64 and assigns it to the DeviceCount field. func (o *Tenant) SetDeviceCount(v int64) { - o.DeviceCount = v + o.DeviceCount = &v } // GetIpaddressCount returns the IpaddressCount field value @@ -725,7 +732,9 @@ func (o Tenant) ToMap() (map[string]interface{}, error) { toSerialize["created"] = o.Created.Get() toSerialize["last_updated"] = o.LastUpdated.Get() toSerialize["circuit_count"] = o.CircuitCount - toSerialize["device_count"] = o.DeviceCount + if !IsNil(o.DeviceCount) { + toSerialize["device_count"] = o.DeviceCount + } toSerialize["ipaddress_count"] = o.IpaddressCount toSerialize["prefix_count"] = o.PrefixCount toSerialize["rack_count"] = o.RackCount @@ -756,7 +765,6 @@ func (o *Tenant) UnmarshalJSON(data []byte) (err error) { "created", "last_updated", "circuit_count", - "device_count", "ipaddress_count", "prefix_count", "rack_count", diff --git a/scripts/fix-spec.py b/scripts/fix-spec.py index fac390124a..0b05f09e83 100755 --- a/scripts/fix-spec.py +++ b/scripts/fix-spec.py @@ -27,7 +27,8 @@ for ntype in nullable_types: if ntype in schema['properties']: - schema['properties'][ntype]['nullable'] = True + if 'nullable' in schema['properties'][ntype]: + schema['properties'][ntype]['nullable'] = True # Fix non-nullable types # See: https://github.com/OpenAPITools/openapi-generator/issues/18006 @@ -41,6 +42,11 @@ if schema['properties'][ntype]['format'] == 'binary': schema['properties'][ntype].pop('nullable') + # Fix required 'device_count' not returned by Netbox API + if 'required' in schema: + if 'device_count' in schema['required']: + schema['required'].remove('device_count') + # Save the spec file with open(SPEC_PATH, 'w') as file: yaml.dump(data, file, Dumper=yaml.CDumper, sort_keys=False)