diff --git a/Makefile b/Makefile index 8dd108e961..b0a275e752 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,8 @@ build: $(EXEC) goimports -w . # Build without fetching a new version of openapi.yaml from netbox-docker -.PHONY: build -build: +.PHONY: build-no-fetch +build-no-fetch: $(EXEC) ./scripts/set-versions.sh $(NETBOX_VERSION) $(NETBOX_DOCKER_VERSION) $(EXEC) ./scripts/fix-spec.py ./scripts/generate-code.sh diff --git a/api/openapi.yaml b/api/openapi.yaml index 4409bb6e2d..881483c48c 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -105446,7 +105446,6 @@ components: - id - name - url - - virtualmachine_count BriefClusterGroup: type: object description: Adds support for custom fields and tags. @@ -105941,7 +105940,6 @@ components: - name - slug - url - - virtualmachine_count BriefDeviceRoleRequest: type: object description: Adds support for custom fields and tags. @@ -106726,7 +106724,6 @@ components: format: int64 readOnly: true required: - - devicetype_count - display - id - name @@ -106868,7 +106865,6 @@ components: - name - slug - url - - virtualmachine_count BriefPlatformRequest: type: object description: Adds support for custom fields and tags. @@ -109546,7 +109542,6 @@ components: - name - type - url - - virtualmachine_count ClusterGroup: type: object description: Adds support for custom fields and tags. @@ -113081,7 +113076,6 @@ components: - name - slug - url - - virtualmachine_count DeviceRoleRequest: type: object description: Adds support for custom fields and tags. @@ -122498,7 +122492,6 @@ components: readOnly: true required: - created - - devicetype_count - display - display_url - id @@ -136601,7 +136594,6 @@ components: - name - slug - url - - virtualmachine_count PlatformRequest: type: object description: Adds support for custom fields and tags. @@ -144072,7 +144064,6 @@ components: - rack_count - slug - url - - virtualmachine_count - vlan_count SiteGroup: type: object @@ -144531,7 +144522,6 @@ components: - site_count - slug - url - - virtualmachine_count - vlan_count - vrf_count TenantGroup: diff --git a/contributing.md b/contributing.md index f76192a791..2255286327 100644 --- a/contributing.md +++ b/contributing.md @@ -5,8 +5,8 @@ The `go-netbox` project makes use of the [GitHub Flow](https://docs.github.com/g for contributions. If you'd like to contribute to the project, please -[open an issue](https://github.com/netbox-community/go-netbox/issues/new) or find an -[existing issue](https://github.com/netbox-community/go-netbox/issues) that you'd like +[open an issue](https://github.com/intercloud/go-netbox/issues/new) or find an +[existing issue](https://github.com/intercloud/go-netbox/issues) that you'd like to take on. This ensures that efforts are not duplicated, and that a new feature aligns with the focus of the rest of the repository. @@ -20,7 +20,7 @@ code meets the following criteria: In addition, if this is your first time contributing to the `go-netbox` project, add your name and email address to the -[AUTHORS](https://github.com/netbox-community/go-netbox/blob/master/AUTHORS) file +[AUTHORS](https://github.com/intercloud/go-netbox/blob/master/AUTHORS) file under the "Contributors" section using the format: `First Last `. diff --git a/docs/BriefCluster.md b/docs/BriefCluster.md index 9520dc9283..b1aab83b08 100644 --- a/docs/BriefCluster.md +++ b/docs/BriefCluster.md @@ -9,13 +9,13 @@ Name | Type | Description | Notes **Display** | **string** | | [readonly] **Name** | **string** | | **Description** | Pointer to **string** | | [optional] -**VirtualmachineCount** | **int64** | | [readonly] +**VirtualmachineCount** | Pointer to **int64** | | [optional] [readonly] ## Methods ### NewBriefCluster -`func NewBriefCluster(id int32, url string, display string, name string, virtualmachineCount int64, ) *BriefCluster` +`func NewBriefCluster(id int32, url string, display string, name string, ) *BriefCluster` NewBriefCluster instantiates a new BriefCluster 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. SetVirtualmachineCount sets VirtualmachineCount field to given value. +### HasVirtualmachineCount + +`func (o *BriefCluster) HasVirtualmachineCount() bool` + +HasVirtualmachineCount 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/BriefDeviceRole.md b/docs/BriefDeviceRole.md index 8e93e7427d..8f86b010ef 100644 --- a/docs/BriefDeviceRole.md +++ b/docs/BriefDeviceRole.md @@ -11,13 +11,13 @@ Name | Type | Description | Notes **Slug** | **string** | | **Description** | Pointer to **string** | | [optional] **DeviceCount** | Pointer to **int64** | | [optional] [readonly] -**VirtualmachineCount** | **int64** | | [readonly] +**VirtualmachineCount** | Pointer to **int64** | | [optional] [readonly] ## Methods ### NewBriefDeviceRole -`func NewBriefDeviceRole(id int32, url string, display string, name string, slug string, virtualmachineCount int64, ) *BriefDeviceRole` +`func NewBriefDeviceRole(id int32, url string, display string, name string, slug string, ) *BriefDeviceRole` NewBriefDeviceRole instantiates a new BriefDeviceRole object This constructor will assign default values to properties that have it defined, @@ -201,6 +201,11 @@ and a boolean to check if the value has been set. SetVirtualmachineCount sets VirtualmachineCount field to given value. +### HasVirtualmachineCount + +`func (o *BriefDeviceRole) HasVirtualmachineCount() bool` + +HasVirtualmachineCount 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/BriefManufacturer.md b/docs/BriefManufacturer.md index 3994a30516..19cbc042b6 100644 --- a/docs/BriefManufacturer.md +++ b/docs/BriefManufacturer.md @@ -10,13 +10,13 @@ Name | Type | Description | Notes **Name** | **string** | | **Slug** | **string** | | **Description** | Pointer to **string** | | [optional] -**DevicetypeCount** | **int64** | | [readonly] +**DevicetypeCount** | Pointer to **int64** | | [optional] [readonly] ## Methods ### NewBriefManufacturer -`func NewBriefManufacturer(id int32, url string, display string, name string, slug string, devicetypeCount int64, ) *BriefManufacturer` +`func NewBriefManufacturer(id int32, url string, display string, name string, slug string, ) *BriefManufacturer` NewBriefManufacturer instantiates a new BriefManufacturer object This constructor will assign default values to properties that have it defined, @@ -175,6 +175,11 @@ and a boolean to check if the value has been set. SetDevicetypeCount sets DevicetypeCount field to given value. +### HasDevicetypeCount + +`func (o *BriefManufacturer) HasDevicetypeCount() bool` + +HasDevicetypeCount 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 3f9a65a5ab..03d1145155 100644 --- a/docs/BriefPlatform.md +++ b/docs/BriefPlatform.md @@ -11,13 +11,13 @@ Name | Type | Description | Notes **Slug** | **string** | | **Description** | Pointer to **string** | | [optional] **DeviceCount** | Pointer to **int64** | | [optional] [readonly] -**VirtualmachineCount** | **int64** | | [readonly] +**VirtualmachineCount** | Pointer to **int64** | | [optional] [readonly] ## Methods ### NewBriefPlatform -`func NewBriefPlatform(id int32, url string, display string, name string, slug string, virtualmachineCount int64, ) *BriefPlatform` +`func NewBriefPlatform(id int32, url string, display string, name string, slug string, ) *BriefPlatform` NewBriefPlatform instantiates a new BriefPlatform object This constructor will assign default values to properties that have it defined, @@ -201,6 +201,11 @@ and a boolean to check if the value has been set. SetVirtualmachineCount sets VirtualmachineCount field to given value. +### HasVirtualmachineCount + +`func (o *BriefPlatform) HasVirtualmachineCount() bool` + +HasVirtualmachineCount 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 236320d72b..ccdfb43761 100644 --- a/docs/Cluster.md +++ b/docs/Cluster.md @@ -21,13 +21,13 @@ Name | Type | Description | Notes **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] **DeviceCount** | Pointer to **int64** | | [optional] [readonly] -**VirtualmachineCount** | **int64** | | [readonly] +**VirtualmachineCount** | Pointer to **int64** | | [optional] [readonly] ## Methods ### NewCluster -`func NewCluster(id int32, url string, displayUrl string, display string, name string, type_ BriefClusterType, created NullableTime, lastUpdated NullableTime, virtualmachineCount int64, ) *Cluster` +`func NewCluster(id int32, url string, displayUrl string, display string, name string, type_ BriefClusterType, created NullableTime, lastUpdated NullableTime, ) *Cluster` NewCluster instantiates a new Cluster object This constructor will assign default values to properties that have it defined, @@ -496,6 +496,11 @@ and a boolean to check if the value has been set. SetVirtualmachineCount sets VirtualmachineCount field to given value. +### HasVirtualmachineCount + +`func (o *Cluster) HasVirtualmachineCount() bool` + +HasVirtualmachineCount 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/DeviceRole.md b/docs/DeviceRole.md index c5002d9a81..1ab6beaa3e 100644 --- a/docs/DeviceRole.md +++ b/docs/DeviceRole.md @@ -19,13 +19,13 @@ Name | Type | Description | Notes **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] **DeviceCount** | Pointer to **int64** | | [optional] [readonly] -**VirtualmachineCount** | **int64** | | [readonly] +**VirtualmachineCount** | Pointer to **int64** | | [optional] [readonly] ## Methods ### NewDeviceRole -`func NewDeviceRole(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, virtualmachineCount int64, ) *DeviceRole` +`func NewDeviceRole(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, ) *DeviceRole` NewDeviceRole instantiates a new DeviceRole object This constructor will assign default values to properties that have it defined, @@ -424,6 +424,11 @@ and a boolean to check if the value has been set. SetVirtualmachineCount sets VirtualmachineCount field to given value. +### HasVirtualmachineCount + +`func (o *DeviceRole) HasVirtualmachineCount() bool` + +HasVirtualmachineCount 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/Manufacturer.md b/docs/Manufacturer.md index 8b98ccdf80..195a70ad07 100644 --- a/docs/Manufacturer.md +++ b/docs/Manufacturer.md @@ -15,7 +15,7 @@ Name | Type | Description | Notes **CustomFields** | Pointer to **map[string]interface{}** | | [optional] **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] -**DevicetypeCount** | **int64** | | [readonly] +**DevicetypeCount** | Pointer to **int64** | | [optional] [readonly] **InventoryitemCount** | **int64** | | [readonly] **PlatformCount** | **int64** | | [readonly] @@ -23,7 +23,7 @@ Name | Type | Description | Notes ### NewManufacturer -`func NewManufacturer(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, devicetypeCount int64, inventoryitemCount int64, platformCount int64, ) *Manufacturer` +`func NewManufacturer(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, inventoryitemCount int64, platformCount int64, ) *Manufacturer` NewManufacturer instantiates a new Manufacturer object This constructor will assign default values to properties that have it defined, @@ -312,6 +312,11 @@ and a boolean to check if the value has been set. SetDevicetypeCount sets DevicetypeCount field to given value. +### HasDevicetypeCount + +`func (o *Manufacturer) HasDevicetypeCount() bool` + +HasDevicetypeCount returns a boolean if a field has been set. ### GetInventoryitemCount diff --git a/docs/Platform.md b/docs/Platform.md index 8d8046fbf4..dc8b1beb4a 100644 --- a/docs/Platform.md +++ b/docs/Platform.md @@ -18,13 +18,13 @@ Name | Type | Description | Notes **Created** | **NullableTime** | | [readonly] **LastUpdated** | **NullableTime** | | [readonly] **DeviceCount** | Pointer to **int64** | | [optional] [readonly] -**VirtualmachineCount** | **int64** | | [readonly] +**VirtualmachineCount** | Pointer to **int64** | | [optional] [readonly] ## Methods ### NewPlatform -`func NewPlatform(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, virtualmachineCount int64, ) *Platform` +`func NewPlatform(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, ) *Platform` NewPlatform instantiates a new Platform object This constructor will assign default values to properties that have it defined, @@ -408,6 +408,11 @@ and a boolean to check if the value has been set. SetVirtualmachineCount sets VirtualmachineCount field to given value. +### HasVirtualmachineCount + +`func (o *Platform) HasVirtualmachineCount() bool` + +HasVirtualmachineCount 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/Site.md b/docs/Site.md index 01bbdb8939..4c62e77e48 100644 --- a/docs/Site.md +++ b/docs/Site.md @@ -31,14 +31,14 @@ Name | Type | Description | Notes **DeviceCount** | Pointer to **int64** | | [optional] [readonly] **PrefixCount** | **int64** | | [readonly] **RackCount** | **int64** | | [readonly] -**VirtualmachineCount** | **int64** | | [readonly] +**VirtualmachineCount** | Pointer to **int64** | | [optional] [readonly] **VlanCount** | **int64** | | [readonly] ## Methods ### NewSite -`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` +`func NewSite(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, circuitCount int64, prefixCount int64, rackCount int64, vlanCount int64, ) *Site` NewSite instantiates a new Site object This constructor will assign default values to properties that have it defined, @@ -772,6 +772,11 @@ and a boolean to check if the value has been set. SetVirtualmachineCount sets VirtualmachineCount field to given value. +### HasVirtualmachineCount + +`func (o *Site) HasVirtualmachineCount() bool` + +HasVirtualmachineCount returns a boolean if a field has been set. ### GetVlanCount diff --git a/docs/Tenant.md b/docs/Tenant.md index b33fc64730..255a13116e 100644 --- a/docs/Tenant.md +++ b/docs/Tenant.md @@ -23,7 +23,7 @@ Name | Type | Description | Notes **PrefixCount** | **int64** | | [readonly] **RackCount** | **int64** | | [readonly] **SiteCount** | **int64** | | [readonly] -**VirtualmachineCount** | **int64** | | [readonly] +**VirtualmachineCount** | Pointer to **int64** | | [optional] [readonly] **VlanCount** | **int64** | | [readonly] **VrfCount** | **int64** | | [readonly] **ClusterCount** | **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, 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, 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, @@ -506,6 +506,11 @@ and a boolean to check if the value has been set. SetVirtualmachineCount sets VirtualmachineCount field to given value. +### HasVirtualmachineCount + +`func (o *Tenant) HasVirtualmachineCount() bool` + +HasVirtualmachineCount returns a boolean if a field has been set. ### GetVlanCount diff --git a/model_brief_cluster.go b/model_brief_cluster.go index c581e65a43..df84ea9f64 100644 --- a/model_brief_cluster.go +++ b/model_brief_cluster.go @@ -25,7 +25,7 @@ type BriefCluster struct { Display string `json:"display"` Name string `json:"name"` Description *string `json:"description,omitempty"` - VirtualmachineCount int64 `json:"virtualmachine_count"` + VirtualmachineCount *int64 `json:"virtualmachine_count,omitempty"` AdditionalProperties map[string]interface{} } @@ -35,13 +35,12 @@ type _BriefCluster BriefCluster // 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 NewBriefCluster(id int32, url string, display string, name string, virtualmachineCount int64) *BriefCluster { +func NewBriefCluster(id int32, url string, display string, name string) *BriefCluster { this := BriefCluster{} this.Id = id this.Url = url this.Display = display this.Name = name - this.VirtualmachineCount = virtualmachineCount return &this } @@ -181,28 +180,36 @@ func (o *BriefCluster) SetDescription(v string) { o.Description = &v } -// GetVirtualmachineCount returns the VirtualmachineCount field value +// GetVirtualmachineCount returns the VirtualmachineCount field value if set, zero value otherwise. func (o *BriefCluster) GetVirtualmachineCount() int64 { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { var ret int64 return ret } - - return o.VirtualmachineCount + return *o.VirtualmachineCount } -// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value +// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BriefCluster) GetVirtualmachineCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { return nil, false } - return &o.VirtualmachineCount, true + return o.VirtualmachineCount, true +} + +// HasVirtualmachineCount returns a boolean if a field has been set. +func (o *BriefCluster) HasVirtualmachineCount() bool { + if o != nil && !IsNil(o.VirtualmachineCount) { + return true + } + + return false } -// SetVirtualmachineCount sets field value +// SetVirtualmachineCount gets a reference to the given int64 and assigns it to the VirtualmachineCount field. func (o *BriefCluster) SetVirtualmachineCount(v int64) { - o.VirtualmachineCount = v + o.VirtualmachineCount = &v } func (o BriefCluster) MarshalJSON() ([]byte, error) { @@ -222,7 +229,9 @@ func (o BriefCluster) ToMap() (map[string]interface{}, error) { if !IsNil(o.Description) { toSerialize["description"] = o.Description } - toSerialize["virtualmachine_count"] = o.VirtualmachineCount + if !IsNil(o.VirtualmachineCount) { + toSerialize["virtualmachine_count"] = o.VirtualmachineCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -240,7 +249,6 @@ func (o *BriefCluster) UnmarshalJSON(data []byte) (err error) { "url", "display", "name", - "virtualmachine_count", } allProperties := make(map[string]interface{}) diff --git a/model_brief_device_role.go b/model_brief_device_role.go index 76b577ef9b..bed181246c 100644 --- a/model_brief_device_role.go +++ b/model_brief_device_role.go @@ -27,7 +27,7 @@ type BriefDeviceRole struct { Slug string `json:"slug"` Description *string `json:"description,omitempty"` DeviceCount *int64 `json:"device_count,omitempty"` - VirtualmachineCount int64 `json:"virtualmachine_count"` + VirtualmachineCount *int64 `json:"virtualmachine_count,omitempty"` 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, virtualmachineCount int64) *BriefDeviceRole { +func NewBriefDeviceRole(id int32, url string, display string, name string, slug string) *BriefDeviceRole { this := BriefDeviceRole{} this.Id = id this.Url = url this.Display = display this.Name = name this.Slug = slug - this.VirtualmachineCount = virtualmachineCount return &this } @@ -240,28 +239,36 @@ func (o *BriefDeviceRole) SetDeviceCount(v int64) { o.DeviceCount = &v } -// GetVirtualmachineCount returns the VirtualmachineCount field value +// GetVirtualmachineCount returns the VirtualmachineCount field value if set, zero value otherwise. func (o *BriefDeviceRole) GetVirtualmachineCount() int64 { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { var ret int64 return ret } - - return o.VirtualmachineCount + return *o.VirtualmachineCount } -// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value +// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BriefDeviceRole) GetVirtualmachineCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { return nil, false } - return &o.VirtualmachineCount, true + return o.VirtualmachineCount, true +} + +// HasVirtualmachineCount returns a boolean if a field has been set. +func (o *BriefDeviceRole) HasVirtualmachineCount() bool { + if o != nil && !IsNil(o.VirtualmachineCount) { + return true + } + + return false } -// SetVirtualmachineCount sets field value +// SetVirtualmachineCount gets a reference to the given int64 and assigns it to the VirtualmachineCount field. func (o *BriefDeviceRole) SetVirtualmachineCount(v int64) { - o.VirtualmachineCount = v + o.VirtualmachineCount = &v } func (o BriefDeviceRole) MarshalJSON() ([]byte, error) { @@ -285,7 +292,9 @@ func (o BriefDeviceRole) ToMap() (map[string]interface{}, error) { if !IsNil(o.DeviceCount) { toSerialize["device_count"] = o.DeviceCount } - toSerialize["virtualmachine_count"] = o.VirtualmachineCount + if !IsNil(o.VirtualmachineCount) { + toSerialize["virtualmachine_count"] = o.VirtualmachineCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -304,7 +313,6 @@ func (o *BriefDeviceRole) UnmarshalJSON(data []byte) (err error) { "display", "name", "slug", - "virtualmachine_count", } allProperties := make(map[string]interface{}) diff --git a/model_brief_manufacturer.go b/model_brief_manufacturer.go index 4eaa45da07..8fa57edd0f 100644 --- a/model_brief_manufacturer.go +++ b/model_brief_manufacturer.go @@ -26,7 +26,7 @@ type BriefManufacturer struct { Name string `json:"name"` Slug string `json:"slug"` Description *string `json:"description,omitempty"` - DevicetypeCount int64 `json:"devicetype_count"` + DevicetypeCount *int64 `json:"devicetype_count,omitempty"` AdditionalProperties map[string]interface{} } @@ -36,14 +36,13 @@ type _BriefManufacturer BriefManufacturer // 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 NewBriefManufacturer(id int32, url string, display string, name string, slug string, devicetypeCount int64) *BriefManufacturer { +func NewBriefManufacturer(id int32, url string, display string, name string, slug string) *BriefManufacturer { this := BriefManufacturer{} this.Id = id this.Url = url this.Display = display this.Name = name this.Slug = slug - this.DevicetypeCount = devicetypeCount return &this } @@ -207,28 +206,36 @@ func (o *BriefManufacturer) SetDescription(v string) { o.Description = &v } -// GetDevicetypeCount returns the DevicetypeCount field value +// GetDevicetypeCount returns the DevicetypeCount field value if set, zero value otherwise. func (o *BriefManufacturer) GetDevicetypeCount() int64 { - if o == nil { + if o == nil || IsNil(o.DevicetypeCount) { var ret int64 return ret } - - return o.DevicetypeCount + return *o.DevicetypeCount } -// GetDevicetypeCountOk returns a tuple with the DevicetypeCount field value +// GetDevicetypeCountOk returns a tuple with the DevicetypeCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BriefManufacturer) GetDevicetypeCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DevicetypeCount) { return nil, false } - return &o.DevicetypeCount, true + return o.DevicetypeCount, true +} + +// HasDevicetypeCount returns a boolean if a field has been set. +func (o *BriefManufacturer) HasDevicetypeCount() bool { + if o != nil && !IsNil(o.DevicetypeCount) { + return true + } + + return false } -// SetDevicetypeCount sets field value +// SetDevicetypeCount gets a reference to the given int64 and assigns it to the DevicetypeCount field. func (o *BriefManufacturer) SetDevicetypeCount(v int64) { - o.DevicetypeCount = v + o.DevicetypeCount = &v } func (o BriefManufacturer) MarshalJSON() ([]byte, error) { @@ -249,7 +256,9 @@ func (o BriefManufacturer) ToMap() (map[string]interface{}, error) { if !IsNil(o.Description) { toSerialize["description"] = o.Description } - toSerialize["devicetype_count"] = o.DevicetypeCount + if !IsNil(o.DevicetypeCount) { + toSerialize["devicetype_count"] = o.DevicetypeCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -268,7 +277,6 @@ func (o *BriefManufacturer) UnmarshalJSON(data []byte) (err error) { "display", "name", "slug", - "devicetype_count", } allProperties := make(map[string]interface{}) diff --git a/model_brief_platform.go b/model_brief_platform.go index a040446ed3..92cff55393 100644 --- a/model_brief_platform.go +++ b/model_brief_platform.go @@ -27,7 +27,7 @@ type BriefPlatform struct { Slug string `json:"slug"` Description *string `json:"description,omitempty"` DeviceCount *int64 `json:"device_count,omitempty"` - VirtualmachineCount int64 `json:"virtualmachine_count"` + VirtualmachineCount *int64 `json:"virtualmachine_count,omitempty"` 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, virtualmachineCount int64) *BriefPlatform { +func NewBriefPlatform(id int32, url string, display string, name string, slug string) *BriefPlatform { this := BriefPlatform{} this.Id = id this.Url = url this.Display = display this.Name = name this.Slug = slug - this.VirtualmachineCount = virtualmachineCount return &this } @@ -240,28 +239,36 @@ func (o *BriefPlatform) SetDeviceCount(v int64) { o.DeviceCount = &v } -// GetVirtualmachineCount returns the VirtualmachineCount field value +// GetVirtualmachineCount returns the VirtualmachineCount field value if set, zero value otherwise. func (o *BriefPlatform) GetVirtualmachineCount() int64 { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { var ret int64 return ret } - - return o.VirtualmachineCount + return *o.VirtualmachineCount } -// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value +// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BriefPlatform) GetVirtualmachineCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { return nil, false } - return &o.VirtualmachineCount, true + return o.VirtualmachineCount, true +} + +// HasVirtualmachineCount returns a boolean if a field has been set. +func (o *BriefPlatform) HasVirtualmachineCount() bool { + if o != nil && !IsNil(o.VirtualmachineCount) { + return true + } + + return false } -// SetVirtualmachineCount sets field value +// SetVirtualmachineCount gets a reference to the given int64 and assigns it to the VirtualmachineCount field. func (o *BriefPlatform) SetVirtualmachineCount(v int64) { - o.VirtualmachineCount = v + o.VirtualmachineCount = &v } func (o BriefPlatform) MarshalJSON() ([]byte, error) { @@ -285,7 +292,9 @@ func (o BriefPlatform) ToMap() (map[string]interface{}, error) { if !IsNil(o.DeviceCount) { toSerialize["device_count"] = o.DeviceCount } - toSerialize["virtualmachine_count"] = o.VirtualmachineCount + if !IsNil(o.VirtualmachineCount) { + toSerialize["virtualmachine_count"] = o.VirtualmachineCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -304,7 +313,6 @@ func (o *BriefPlatform) UnmarshalJSON(data []byte) (err error) { "display", "name", "slug", - "virtualmachine_count", } allProperties := make(map[string]interface{}) diff --git a/model_cluster.go b/model_cluster.go index f09c0677de..a11ca90a5d 100644 --- a/model_cluster.go +++ b/model_cluster.go @@ -38,7 +38,7 @@ type Cluster struct { Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` DeviceCount *int64 `json:"device_count,omitempty"` - VirtualmachineCount int64 `json:"virtualmachine_count"` + VirtualmachineCount *int64 `json:"virtualmachine_count,omitempty"` 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, virtualmachineCount int64) *Cluster { +func NewCluster(id int32, url string, displayUrl string, display string, name string, type_ BriefClusterType, created NullableTime, lastUpdated NullableTime) *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.VirtualmachineCount = virtualmachineCount return &this } @@ -587,28 +586,36 @@ func (o *Cluster) SetDeviceCount(v int64) { o.DeviceCount = &v } -// GetVirtualmachineCount returns the VirtualmachineCount field value +// GetVirtualmachineCount returns the VirtualmachineCount field value if set, zero value otherwise. func (o *Cluster) GetVirtualmachineCount() int64 { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { var ret int64 return ret } - - return o.VirtualmachineCount + return *o.VirtualmachineCount } -// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value +// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Cluster) GetVirtualmachineCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { return nil, false } - return &o.VirtualmachineCount, true + return o.VirtualmachineCount, true +} + +// HasVirtualmachineCount returns a boolean if a field has been set. +func (o *Cluster) HasVirtualmachineCount() bool { + if o != nil && !IsNil(o.VirtualmachineCount) { + return true + } + + return false } -// SetVirtualmachineCount sets field value +// SetVirtualmachineCount gets a reference to the given int64 and assigns it to the VirtualmachineCount field. func (o *Cluster) SetVirtualmachineCount(v int64) { - o.VirtualmachineCount = v + o.VirtualmachineCount = &v } func (o Cluster) MarshalJSON() ([]byte, error) { @@ -656,7 +663,9 @@ func (o Cluster) ToMap() (map[string]interface{}, error) { if !IsNil(o.DeviceCount) { toSerialize["device_count"] = o.DeviceCount } - toSerialize["virtualmachine_count"] = o.VirtualmachineCount + if !IsNil(o.VirtualmachineCount) { + toSerialize["virtualmachine_count"] = o.VirtualmachineCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -678,7 +687,6 @@ func (o *Cluster) UnmarshalJSON(data []byte) (err error) { "type", "created", "last_updated", - "virtualmachine_count", } allProperties := make(map[string]interface{}) diff --git a/model_device_role.go b/model_device_role.go index 51e8e940ad..ef4c31a8b2 100644 --- a/model_device_role.go +++ b/model_device_role.go @@ -37,7 +37,7 @@ type DeviceRole struct { Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` DeviceCount *int64 `json:"device_count,omitempty"` - VirtualmachineCount int64 `json:"virtualmachine_count"` + VirtualmachineCount *int64 `json:"virtualmachine_count,omitempty"` 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, virtualmachineCount int64) *DeviceRole { +func NewDeviceRole(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime) *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.VirtualmachineCount = virtualmachineCount return &this } @@ -500,28 +499,36 @@ func (o *DeviceRole) SetDeviceCount(v int64) { o.DeviceCount = &v } -// GetVirtualmachineCount returns the VirtualmachineCount field value +// GetVirtualmachineCount returns the VirtualmachineCount field value if set, zero value otherwise. func (o *DeviceRole) GetVirtualmachineCount() int64 { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { var ret int64 return ret } - - return o.VirtualmachineCount + return *o.VirtualmachineCount } -// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value +// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceRole) GetVirtualmachineCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { return nil, false } - return &o.VirtualmachineCount, true + return o.VirtualmachineCount, true +} + +// HasVirtualmachineCount returns a boolean if a field has been set. +func (o *DeviceRole) HasVirtualmachineCount() bool { + if o != nil && !IsNil(o.VirtualmachineCount) { + return true + } + + return false } -// SetVirtualmachineCount sets field value +// SetVirtualmachineCount gets a reference to the given int64 and assigns it to the VirtualmachineCount field. func (o *DeviceRole) SetVirtualmachineCount(v int64) { - o.VirtualmachineCount = v + o.VirtualmachineCount = &v } func (o DeviceRole) MarshalJSON() ([]byte, error) { @@ -563,7 +570,9 @@ func (o DeviceRole) ToMap() (map[string]interface{}, error) { if !IsNil(o.DeviceCount) { toSerialize["device_count"] = o.DeviceCount } - toSerialize["virtualmachine_count"] = o.VirtualmachineCount + if !IsNil(o.VirtualmachineCount) { + toSerialize["virtualmachine_count"] = o.VirtualmachineCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -585,7 +594,6 @@ func (o *DeviceRole) UnmarshalJSON(data []byte) (err error) { "slug", "created", "last_updated", - "virtualmachine_count", } allProperties := make(map[string]interface{}) diff --git a/model_manufacturer.go b/model_manufacturer.go index a1e268c206..7e83079694 100644 --- a/model_manufacturer.go +++ b/model_manufacturer.go @@ -32,7 +32,7 @@ type Manufacturer struct { CustomFields map[string]interface{} `json:"custom_fields,omitempty"` Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` - DevicetypeCount int64 `json:"devicetype_count"` + DevicetypeCount *int64 `json:"devicetype_count,omitempty"` InventoryitemCount int64 `json:"inventoryitem_count"` PlatformCount int64 `json:"platform_count"` AdditionalProperties map[string]interface{} @@ -44,7 +44,7 @@ type _Manufacturer Manufacturer // 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 NewManufacturer(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, devicetypeCount int64, inventoryitemCount int64, platformCount int64) *Manufacturer { +func NewManufacturer(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime, inventoryitemCount int64, platformCount int64) *Manufacturer { this := Manufacturer{} this.Id = id this.Url = url @@ -54,7 +54,6 @@ func NewManufacturer(id int32, url string, displayUrl string, display string, na this.Slug = slug this.Created = created this.LastUpdated = lastUpdated - this.DevicetypeCount = devicetypeCount this.InventoryitemCount = inventoryitemCount this.PlatformCount = platformCount return &this @@ -360,28 +359,36 @@ func (o *Manufacturer) SetLastUpdated(v time.Time) { o.LastUpdated.Set(&v) } -// GetDevicetypeCount returns the DevicetypeCount field value +// GetDevicetypeCount returns the DevicetypeCount field value if set, zero value otherwise. func (o *Manufacturer) GetDevicetypeCount() int64 { - if o == nil { + if o == nil || IsNil(o.DevicetypeCount) { var ret int64 return ret } - - return o.DevicetypeCount + return *o.DevicetypeCount } -// GetDevicetypeCountOk returns a tuple with the DevicetypeCount field value +// GetDevicetypeCountOk returns a tuple with the DevicetypeCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Manufacturer) GetDevicetypeCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DevicetypeCount) { return nil, false } - return &o.DevicetypeCount, true + return o.DevicetypeCount, true +} + +// HasDevicetypeCount returns a boolean if a field has been set. +func (o *Manufacturer) HasDevicetypeCount() bool { + if o != nil && !IsNil(o.DevicetypeCount) { + return true + } + + return false } -// SetDevicetypeCount sets field value +// SetDevicetypeCount gets a reference to the given int64 and assigns it to the DevicetypeCount field. func (o *Manufacturer) SetDevicetypeCount(v int64) { - o.DevicetypeCount = v + o.DevicetypeCount = &v } // GetInventoryitemCount returns the InventoryitemCount field value @@ -459,7 +466,9 @@ func (o Manufacturer) ToMap() (map[string]interface{}, error) { } toSerialize["created"] = o.Created.Get() toSerialize["last_updated"] = o.LastUpdated.Get() - toSerialize["devicetype_count"] = o.DevicetypeCount + if !IsNil(o.DevicetypeCount) { + toSerialize["devicetype_count"] = o.DevicetypeCount + } toSerialize["inventoryitem_count"] = o.InventoryitemCount toSerialize["platform_count"] = o.PlatformCount @@ -483,7 +492,6 @@ func (o *Manufacturer) UnmarshalJSON(data []byte) (err error) { "slug", "created", "last_updated", - "devicetype_count", "inventoryitem_count", "platform_count", } diff --git a/model_platform.go b/model_platform.go index caec878eb2..6e19cdb97a 100644 --- a/model_platform.go +++ b/model_platform.go @@ -35,7 +35,7 @@ type Platform struct { Created NullableTime `json:"created"` LastUpdated NullableTime `json:"last_updated"` DeviceCount *int64 `json:"device_count,omitempty"` - VirtualmachineCount int64 `json:"virtualmachine_count"` + VirtualmachineCount *int64 `json:"virtualmachine_count,omitempty"` 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, virtualmachineCount int64) *Platform { +func NewPlatform(id int32, url string, displayUrl string, display string, name string, slug string, created NullableTime, lastUpdated NullableTime) *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.VirtualmachineCount = virtualmachineCount return &this } @@ -477,28 +476,36 @@ func (o *Platform) SetDeviceCount(v int64) { o.DeviceCount = &v } -// GetVirtualmachineCount returns the VirtualmachineCount field value +// GetVirtualmachineCount returns the VirtualmachineCount field value if set, zero value otherwise. func (o *Platform) GetVirtualmachineCount() int64 { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { var ret int64 return ret } - - return o.VirtualmachineCount + return *o.VirtualmachineCount } -// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value +// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Platform) GetVirtualmachineCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { return nil, false } - return &o.VirtualmachineCount, true + return o.VirtualmachineCount, true +} + +// HasVirtualmachineCount returns a boolean if a field has been set. +func (o *Platform) HasVirtualmachineCount() bool { + if o != nil && !IsNil(o.VirtualmachineCount) { + return true + } + + return false } -// SetVirtualmachineCount sets field value +// SetVirtualmachineCount gets a reference to the given int64 and assigns it to the VirtualmachineCount field. func (o *Platform) SetVirtualmachineCount(v int64) { - o.VirtualmachineCount = v + o.VirtualmachineCount = &v } func (o Platform) MarshalJSON() ([]byte, error) { @@ -537,7 +544,9 @@ func (o Platform) ToMap() (map[string]interface{}, error) { if !IsNil(o.DeviceCount) { toSerialize["device_count"] = o.DeviceCount } - toSerialize["virtualmachine_count"] = o.VirtualmachineCount + if !IsNil(o.VirtualmachineCount) { + toSerialize["virtualmachine_count"] = o.VirtualmachineCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -559,7 +568,6 @@ func (o *Platform) UnmarshalJSON(data []byte) (err error) { "slug", "created", "last_updated", - "virtualmachine_count", } allProperties := make(map[string]interface{}) diff --git a/model_site.go b/model_site.go index 81a9b5cc9c..5d827c5d72 100644 --- a/model_site.go +++ b/model_site.go @@ -54,7 +54,7 @@ type Site struct { DeviceCount *int64 `json:"device_count,omitempty"` PrefixCount int64 `json:"prefix_count"` RackCount int64 `json:"rack_count"` - VirtualmachineCount int64 `json:"virtualmachine_count"` + VirtualmachineCount *int64 `json:"virtualmachine_count,omitempty"` VlanCount int64 `json:"vlan_count"` AdditionalProperties map[string]interface{} } @@ -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, 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, vlanCount int64) *Site { this := Site{} this.Id = id this.Url = url @@ -78,7 +78,6 @@ func NewSite(id int32, url string, displayUrl string, display string, name strin this.CircuitCount = circuitCount this.PrefixCount = prefixCount this.RackCount = rackCount - this.VirtualmachineCount = virtualmachineCount this.VlanCount = vlanCount return &this } @@ -937,28 +936,36 @@ func (o *Site) SetRackCount(v int64) { o.RackCount = v } -// GetVirtualmachineCount returns the VirtualmachineCount field value +// GetVirtualmachineCount returns the VirtualmachineCount field value if set, zero value otherwise. func (o *Site) GetVirtualmachineCount() int64 { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { var ret int64 return ret } - - return o.VirtualmachineCount + return *o.VirtualmachineCount } -// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value +// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Site) GetVirtualmachineCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { return nil, false } - return &o.VirtualmachineCount, true + return o.VirtualmachineCount, true +} + +// HasVirtualmachineCount returns a boolean if a field has been set. +func (o *Site) HasVirtualmachineCount() bool { + if o != nil && !IsNil(o.VirtualmachineCount) { + return true + } + + return false } -// SetVirtualmachineCount sets field value +// SetVirtualmachineCount gets a reference to the given int64 and assigns it to the VirtualmachineCount field. func (o *Site) SetVirtualmachineCount(v int64) { - o.VirtualmachineCount = v + o.VirtualmachineCount = &v } // GetVlanCount returns the VlanCount field value @@ -1054,7 +1061,9 @@ func (o Site) ToMap() (map[string]interface{}, error) { } toSerialize["prefix_count"] = o.PrefixCount toSerialize["rack_count"] = o.RackCount - toSerialize["virtualmachine_count"] = o.VirtualmachineCount + if !IsNil(o.VirtualmachineCount) { + toSerialize["virtualmachine_count"] = o.VirtualmachineCount + } toSerialize["vlan_count"] = o.VlanCount for key, value := range o.AdditionalProperties { @@ -1080,7 +1089,6 @@ func (o *Site) UnmarshalJSON(data []byte) (err error) { "circuit_count", "prefix_count", "rack_count", - "virtualmachine_count", "vlan_count", } diff --git a/model_tenant.go b/model_tenant.go index 30111e98f6..3ca698e105 100644 --- a/model_tenant.go +++ b/model_tenant.go @@ -40,7 +40,7 @@ type Tenant struct { PrefixCount int64 `json:"prefix_count"` RackCount int64 `json:"rack_count"` SiteCount int64 `json:"site_count"` - VirtualmachineCount int64 `json:"virtualmachine_count"` + VirtualmachineCount *int64 `json:"virtualmachine_count,omitempty"` VlanCount int64 `json:"vlan_count"` VrfCount int64 `json:"vrf_count"` ClusterCount int64 `json:"cluster_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, 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, vlanCount int64, vrfCount int64, clusterCount int64) *Tenant { this := Tenant{} this.Id = id this.Url = url @@ -68,7 +68,6 @@ func NewTenant(id int32, url string, displayUrl string, display string, name str this.PrefixCount = prefixCount this.RackCount = rackCount this.SiteCount = siteCount - this.VirtualmachineCount = virtualmachineCount this.VlanCount = vlanCount this.VrfCount = vrfCount this.ClusterCount = clusterCount @@ -602,28 +601,36 @@ func (o *Tenant) SetSiteCount(v int64) { o.SiteCount = v } -// GetVirtualmachineCount returns the VirtualmachineCount field value +// GetVirtualmachineCount returns the VirtualmachineCount field value if set, zero value otherwise. func (o *Tenant) GetVirtualmachineCount() int64 { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { var ret int64 return ret } - - return o.VirtualmachineCount + return *o.VirtualmachineCount } -// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value +// GetVirtualmachineCountOk returns a tuple with the VirtualmachineCount field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Tenant) GetVirtualmachineCountOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.VirtualmachineCount) { return nil, false } - return &o.VirtualmachineCount, true + return o.VirtualmachineCount, true +} + +// HasVirtualmachineCount returns a boolean if a field has been set. +func (o *Tenant) HasVirtualmachineCount() bool { + if o != nil && !IsNil(o.VirtualmachineCount) { + return true + } + + return false } -// SetVirtualmachineCount sets field value +// SetVirtualmachineCount gets a reference to the given int64 and assigns it to the VirtualmachineCount field. func (o *Tenant) SetVirtualmachineCount(v int64) { - o.VirtualmachineCount = v + o.VirtualmachineCount = &v } // GetVlanCount returns the VlanCount field value @@ -739,7 +746,9 @@ func (o Tenant) ToMap() (map[string]interface{}, error) { toSerialize["prefix_count"] = o.PrefixCount toSerialize["rack_count"] = o.RackCount toSerialize["site_count"] = o.SiteCount - toSerialize["virtualmachine_count"] = o.VirtualmachineCount + if !IsNil(o.VirtualmachineCount) { + toSerialize["virtualmachine_count"] = o.VirtualmachineCount + } toSerialize["vlan_count"] = o.VlanCount toSerialize["vrf_count"] = o.VrfCount toSerialize["cluster_count"] = o.ClusterCount @@ -769,7 +778,6 @@ func (o *Tenant) UnmarshalJSON(data []byte) (err error) { "prefix_count", "rack_count", "site_count", - "virtualmachine_count", "vlan_count", "vrf_count", "cluster_count", diff --git a/readme.md b/readme.md index 2dc9553228..1a1f6fbfe4 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # go-netbox -[![GoDoc](https://pkg.go.dev/badge/github.com/netbox-community/go-netbox/v4)](https://pkg.go.dev/github.com/netbox-community/go-netbox/v4) [![Build Status](https://github.com/netbox-community/go-netbox/workflows/main/badge.svg?branch=master)](https://github.com/netbox-community/go-netbox/actions) [![Report Card](https://goreportcard.com/badge/github.com/netbox-community/go-netbox)](https://goreportcard.com/report/github.com/netbox-community/go-netbox) +[![GoDoc](https://pkg.go.dev/badge/github.com/intercloud/go-netbox/v4)](https://pkg.go.dev/github.com/intercloud/go-netbox/v4) [![Build Status](https://github.com/intercloud/go-netbox/workflows/main/badge.svg?branch=master)](https://github.com/intercloud/go-netbox/actions) [![Report Card](https://goreportcard.com/badge/github.com/intercloud/go-netbox)](https://goreportcard.com/report/github.com/intercloud/go-netbox) _go-netbox_ is —to nobody's surprise— the official [Go](https://go.dev) API client for the [Netbox](https://github.com/netbox-community/netbox) IPAM and DCIM service. @@ -11,10 +11,10 @@ This project follows [Semantic Versioning](https://semver.org). The version of t Use `go get` to add the library as a dependency to your project. Do not forget to run `go mod init` first if necessary. ```shell -go get github.com/netbox-community/go-netbox/v4 +go get github.com/intercloud/go-netbox/v4 # Or install a specific version -go get github.com/netbox-community/go-netbox/v4@v4.0.3-0 +go get github.com/intercloud/go-netbox/v4@v4.1.1-5 ``` **Note:** dependencies should be managed with [Go modules](https://go.dev/doc/modules/managing-dependencies). @@ -32,7 +32,7 @@ import ( "context" "log" - "github.com/netbox-community/go-netbox/v4" + "github.com/intercloud/go-netbox/v4" ) func main() { @@ -58,7 +58,7 @@ import ( "context" "log" - "github.com/netbox-community/go-netbox/v4" + "github.com/intercloud/go-netbox/v4" ) func main() { @@ -80,7 +80,7 @@ func main() { } ``` -See [docs](docs) or [reference](https://pkg.go.dev/github.com/netbox-community/go-netbox) for more information on all possible usages. +See [docs](docs) or [reference](https://pkg.go.dev/github.com/intercloud/go-netbox) for more information on all possible usages. ## Development diff --git a/scripts/fetch-spec.sh b/scripts/fetch-spec.sh index 660fb58fc6..2c5ac842db 100755 --- a/scripts/fetch-spec.sh +++ b/scripts/fetch-spec.sh @@ -25,6 +25,6 @@ while ! curl --silent http://localhost:8000/api/schema/ > api/openapi.yaml 2> /d sleep 1 done -docker compose --project-directory="${REPO_DIR}" down #--volumes +docker compose --project-directory="${REPO_DIR}" down --volumes rm -rf "${REPO_DIR}" diff --git a/scripts/fix-spec.py b/scripts/fix-spec.py index 0b05f09e83..5d9626a1f7 100755 --- a/scripts/fix-spec.py +++ b/scripts/fix-spec.py @@ -40,13 +40,20 @@ for ntype in non_nullable_types: if ntype in schema['properties']: if schema['properties'][ntype]['format'] == 'binary': - schema['properties'][ntype].pop('nullable') + if 'nullable' in schema['properties'][ntype]: + schema['properties'][ntype].pop('nullable') - # Fix required 'device_count' not returned by Netbox API + # Fix required '*_count' not returned by Netbox API if 'required' in schema: if 'device_count' in schema['required']: schema['required'].remove('device_count') + if 'devicetype_count' in schema['required']: + schema['required'].remove('devicetype_count') + + if 'virtualmachine_count' in schema['required']: + schema['required'].remove('virtualmachine_count') + # Save the spec file with open(SPEC_PATH, 'w') as file: yaml.dump(data, file, Dumper=yaml.CDumper, sort_keys=False)