diff --git a/api/openapi.yaml b/api/openapi.yaml index df6c440cb0..7b1992463c 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -98121,6 +98121,7 @@ components: parent_device: allOf: - $ref: '#/components/schemas/NestedDevice' + nullable: true readOnly: true status: type: object @@ -98996,6 +98997,7 @@ components: parent_device: allOf: - $ref: '#/components/schemas/NestedDevice' + nullable: true readOnly: true status: type: object diff --git a/docs/Device.md b/docs/Device.md index 92c8beb388..965769b04d 100644 --- a/docs/Device.md +++ b/docs/Device.md @@ -22,7 +22,7 @@ Name | Type | Description | Notes **Face** | Pointer to [**DeviceFace**](DeviceFace.md) | | [optional] **Latitude** | Pointer to **NullableFloat64** | GPS coordinate in decimal format (xx.yyyyyy) | [optional] **Longitude** | Pointer to **NullableFloat64** | GPS coordinate in decimal format (xx.yyyyyy) | [optional] -**ParentDevice** | [**NestedDevice**](NestedDevice.md) | | [readonly] +**ParentDevice** | [**NullableNestedDevice**](NestedDevice.md) | | [readonly] **Status** | Pointer to [**DeviceStatus**](DeviceStatus.md) | | [optional] **Airflow** | Pointer to [**DeviceAirflow**](DeviceAirflow.md) | | [optional] **PrimaryIp** | [**NestedIPAddress**](NestedIPAddress.md) | | [readonly] @@ -56,7 +56,7 @@ Name | Type | Description | Notes ### NewDevice -`func NewDevice(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NestedDevice, primaryIp NestedIPAddress, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32, ) *Device` +`func NewDevice(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NullableNestedDevice, primaryIp NestedIPAddress, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32, ) *Device` NewDevice instantiates a new Device object This constructor will assign default values to properties that have it defined, @@ -596,6 +596,16 @@ and a boolean to check if the value has been set. SetParentDevice sets ParentDevice field to given value. +### SetParentDeviceNil + +`func (o *Device) SetParentDeviceNil(b bool)` + + SetParentDeviceNil sets the value for ParentDevice to be an explicit nil + +### UnsetParentDevice +`func (o *Device) UnsetParentDevice()` + +UnsetParentDevice ensures that no value is present for ParentDevice, not even an explicit nil ### GetStatus `func (o *Device) GetStatus() DeviceStatus` diff --git a/docs/DeviceWithConfigContext.md b/docs/DeviceWithConfigContext.md index 9ad734f3dd..07d7d92670 100644 --- a/docs/DeviceWithConfigContext.md +++ b/docs/DeviceWithConfigContext.md @@ -22,7 +22,7 @@ Name | Type | Description | Notes **Face** | Pointer to [**DeviceFace**](DeviceFace.md) | | [optional] **Latitude** | Pointer to **NullableFloat64** | GPS coordinate in decimal format (xx.yyyyyy) | [optional] **Longitude** | Pointer to **NullableFloat64** | GPS coordinate in decimal format (xx.yyyyyy) | [optional] -**ParentDevice** | [**NestedDevice**](NestedDevice.md) | | [readonly] +**ParentDevice** | [**NullableNestedDevice**](NestedDevice.md) | | [readonly] **Status** | Pointer to [**DeviceStatus**](DeviceStatus.md) | | [optional] **Airflow** | Pointer to [**DeviceAirflow**](DeviceAirflow.md) | | [optional] **PrimaryIp** | [**NestedIPAddress**](NestedIPAddress.md) | | [readonly] @@ -57,7 +57,7 @@ Name | Type | Description | Notes ### NewDeviceWithConfigContext -`func NewDeviceWithConfigContext(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NestedDevice, primaryIp NestedIPAddress, configContext interface{}, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32, ) *DeviceWithConfigContext` +`func NewDeviceWithConfigContext(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NullableNestedDevice, primaryIp NestedIPAddress, configContext interface{}, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32, ) *DeviceWithConfigContext` NewDeviceWithConfigContext instantiates a new DeviceWithConfigContext object This constructor will assign default values to properties that have it defined, @@ -597,6 +597,16 @@ and a boolean to check if the value has been set. SetParentDevice sets ParentDevice field to given value. +### SetParentDeviceNil + +`func (o *DeviceWithConfigContext) SetParentDeviceNil(b bool)` + + SetParentDeviceNil sets the value for ParentDevice to be an explicit nil + +### UnsetParentDevice +`func (o *DeviceWithConfigContext) UnsetParentDevice()` + +UnsetParentDevice ensures that no value is present for ParentDevice, not even an explicit nil ### GetStatus `func (o *DeviceWithConfigContext) GetStatus() DeviceStatus` diff --git a/main.go b/main.go index 94f97df21d..52d78bdce8 100644 --- a/main.go +++ b/main.go @@ -9,8 +9,13 @@ const authHeaderFormat = "Token %v" func NewAPIClientFor(host string, token string) *APIClient { cfg := NewConfiguration() + cfg.Servers[0].URL = host - cfg.DefaultHeader[authHeaderName] = fmt.Sprintf(authHeaderFormat, token) + + cfg.AddDefaultHeader( + authHeaderName, + fmt.Sprintf(authHeaderFormat, token), + ) return NewAPIClient(cfg) } diff --git a/model_device.go b/model_device.go index d5bbf1f937..b48dcc3357 100644 --- a/model_device.go +++ b/model_device.go @@ -43,7 +43,7 @@ type Device struct { Latitude NullableFloat64 `json:"latitude,omitempty"` // GPS coordinate in decimal format (xx.yyyyyy) Longitude NullableFloat64 `json:"longitude,omitempty"` - ParentDevice NestedDevice `json:"parent_device"` + ParentDevice NullableNestedDevice `json:"parent_device"` Status *DeviceStatus `json:"status,omitempty"` Airflow *DeviceAirflow `json:"airflow,omitempty"` PrimaryIp NestedIPAddress `json:"primary_ip"` @@ -83,7 +83,7 @@ type _Device Device // 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 NewDevice(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NestedDevice, primaryIp NestedIPAddress, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32) *Device { +func NewDevice(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NullableNestedDevice, primaryIp NestedIPAddress, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32) *Device { this := Device{} this.Id = id this.Url = url @@ -737,27 +737,29 @@ func (o *Device) UnsetLongitude() { } // GetParentDevice returns the ParentDevice field value +// If the value is explicit nil, the zero value for NestedDevice will be returned func (o *Device) GetParentDevice() NestedDevice { - if o == nil { + if o == nil || o.ParentDevice.Get() == nil { var ret NestedDevice return ret } - return o.ParentDevice + return *o.ParentDevice.Get() } // GetParentDeviceOk returns a tuple with the ParentDevice field value // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Device) GetParentDeviceOk() (*NestedDevice, bool) { if o == nil { return nil, false } - return &o.ParentDevice, true + return o.ParentDevice.Get(), o.ParentDevice.IsSet() } // SetParentDevice sets field value func (o *Device) SetParentDevice(v NestedDevice) { - o.ParentDevice = v + o.ParentDevice.Set(&v) } // GetStatus returns the Status field value if set, zero value otherwise. @@ -1695,7 +1697,7 @@ func (o Device) ToMap() (map[string]interface{}, error) { if o.Longitude.IsSet() { toSerialize["longitude"] = o.Longitude.Get() } - toSerialize["parent_device"] = o.ParentDevice + toSerialize["parent_device"] = o.ParentDevice.Get() if !IsNil(o.Status) { toSerialize["status"] = o.Status } diff --git a/model_device_with_config_context.go b/model_device_with_config_context.go index cfc11753f1..b35153a103 100644 --- a/model_device_with_config_context.go +++ b/model_device_with_config_context.go @@ -43,7 +43,7 @@ type DeviceWithConfigContext struct { Latitude NullableFloat64 `json:"latitude,omitempty"` // GPS coordinate in decimal format (xx.yyyyyy) Longitude NullableFloat64 `json:"longitude,omitempty"` - ParentDevice NestedDevice `json:"parent_device"` + ParentDevice NullableNestedDevice `json:"parent_device"` Status *DeviceStatus `json:"status,omitempty"` Airflow *DeviceAirflow `json:"airflow,omitempty"` PrimaryIp NestedIPAddress `json:"primary_ip"` @@ -84,7 +84,7 @@ type _DeviceWithConfigContext DeviceWithConfigContext // 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 NewDeviceWithConfigContext(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NestedDevice, primaryIp NestedIPAddress, configContext interface{}, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32) *DeviceWithConfigContext { +func NewDeviceWithConfigContext(id int32, url string, display string, deviceType NestedDeviceType, role NestedDeviceRole, deviceRole DeviceDeviceRole, site NestedSite, parentDevice NullableNestedDevice, primaryIp NestedIPAddress, configContext interface{}, created NullableTime, lastUpdated NullableTime, consolePortCount int32, consoleServerPortCount int32, powerPortCount int32, powerOutletCount int32, interfaceCount int32, frontPortCount int32, rearPortCount int32, deviceBayCount int32, moduleBayCount int32, inventoryItemCount int32) *DeviceWithConfigContext { this := DeviceWithConfigContext{} this.Id = id this.Url = url @@ -739,27 +739,29 @@ func (o *DeviceWithConfigContext) UnsetLongitude() { } // GetParentDevice returns the ParentDevice field value +// If the value is explicit nil, the zero value for NestedDevice will be returned func (o *DeviceWithConfigContext) GetParentDevice() NestedDevice { - if o == nil { + if o == nil || o.ParentDevice.Get() == nil { var ret NestedDevice return ret } - return o.ParentDevice + return *o.ParentDevice.Get() } // GetParentDeviceOk returns a tuple with the ParentDevice field value // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *DeviceWithConfigContext) GetParentDeviceOk() (*NestedDevice, bool) { if o == nil { return nil, false } - return &o.ParentDevice, true + return o.ParentDevice.Get(), o.ParentDevice.IsSet() } // SetParentDevice sets field value func (o *DeviceWithConfigContext) SetParentDevice(v NestedDevice) { - o.ParentDevice = v + o.ParentDevice.Set(&v) } // GetStatus returns the Status field value if set, zero value otherwise. @@ -1723,7 +1725,7 @@ func (o DeviceWithConfigContext) ToMap() (map[string]interface{}, error) { if o.Longitude.IsSet() { toSerialize["longitude"] = o.Longitude.Get() } - toSerialize["parent_device"] = o.ParentDevice + toSerialize["parent_device"] = o.ParentDevice.Get() if !IsNil(o.Status) { toSerialize["status"] = o.Status }