func (pciefunction *PCIeFunction) PCIeDevice() (*PCIeDevice, error) {
	if pciefunction.pcieDevice == "" {
		return nil, nil
	}
	return GetPCIeDevice(pciefunction.Client, pciefunction.pcieDevice)
}
PCIeDevice gets the associated PCIe device for this function.
package redfish
import (
	"encoding/json"
	"github.com/stmcginnis/gofish/common"
)
type DeviceClass string
const (
	UnclassifiedDeviceDeviceClass DeviceClass = "UnclassifiedDevice"
	MassStorageControllerDeviceClass DeviceClass = "MassStorageController"
	NetworkControllerDeviceClass DeviceClass = "NetworkController"
	DisplayControllerDeviceClass DeviceClass = "DisplayController"
	MultimediaControllerDeviceClass DeviceClass = "MultimediaController"
	MemoryControllerDeviceClass DeviceClass = "MemoryController"
	BridgeDeviceClass DeviceClass = "Bridge"
	CommunicationControllerDeviceClass DeviceClass = "CommunicationController"
	GenericSystemPeripheralDeviceClass DeviceClass = "GenericSystemPeripheral"
	InputDeviceControllerDeviceClass DeviceClass = "InputDeviceController"
	DockingStationDeviceClass DeviceClass = "DockingStation"
	ProcessorDeviceClass DeviceClass = "Processor"
	SerialBusControllerDeviceClass DeviceClass = "SerialBusController"
	WirelessControllerDeviceClass DeviceClass = "WirelessController"
	IntelligentControllerDeviceClass DeviceClass = "IntelligentController"
	SatelliteCommunicationsControllerDeviceClass DeviceClass = "SatelliteCommunicationsController"
	EncryptionControllerDeviceClass DeviceClass = "EncryptionController"
	SignalProcessingControllerDeviceClass DeviceClass = "SignalProcessingController"
	ProcessingAcceleratorsDeviceClass DeviceClass = "ProcessingAccelerators"
	NonEssentialInstrumentationDeviceClass DeviceClass = "NonEssentialInstrumentation"
	CoprocessorDeviceClass DeviceClass = "Coprocessor"
	UnassignedClassDeviceClass DeviceClass = "UnassignedClass"
	OtherDeviceClass DeviceClass = "Other"
)
type FunctionType string
const (
	PhysicalFunctionType FunctionType = "Physical"
	VirtualFunctionType FunctionType = "Virtual"
)
type PCIeFunction struct {
	common.Entity
	ODataContext string `json:"@odata.context"`
	ODataType string `json:"@odata.type"`
	ClassCode string
	Description string
	DeviceClass DeviceClass
	DeviceID string `json:"DeviceId"`
	FunctionID int `json:"FunctionId"`
	FunctionType FunctionType
	RevisionID string `json:"RevisionID"`
	Status common.Status
	SubsystemID string `json:"SubsystemId"`
	SubsystemVendorID string `json:"SubsystemVendorId"`
	VendorID string `json:"VendorId"`
	drives []string
	DrivesCount int
	ethernetInterfaces []string
	EthernetInterfacesCount int
	networkDeviceFunctions []string
	NetworkDeviceFunctionsCount int
	pcieDevice string
	storageControllers []string
	StorageControllersCount int
}
func (pciefunction *PCIeFunction) UnmarshalJSON(b []byte) error {
	type temp PCIeFunction
	type links struct {
		Drives                      common.Links
		DrivesCount                 int `json:"Drives@odata.count"`
		EthernetInterfaces          common.Links
		EthernetInterfacesCount     int `json:"EthernetInterfaces@odata.count"`
		NetworkDeviceFunctions      common.Links
		NetworkDeviceFunctionsCount int `json:"NetworkDeviceFunctions@odata.count"`
		PCIeDevice                  common.Link
		StorageControllers          common.Links
		StorageControllersCount     int `json:"StorageControllers@odata.count"`
	}
	var t struct {
		temp
		Links links
	}
	err := json.Unmarshal(b, &t)
	if err != nil {
		return err
	}
	*pciefunction = PCIeFunction(t.temp)
	pciefunction.drives = t.Links.Drives.ToStrings()
	pciefunction.DrivesCount = t.Links.DrivesCount
	pciefunction.ethernetInterfaces = t.Links.EthernetInterfaces.ToStrings()
	pciefunction.EthernetInterfacesCount = t.Links.EthernetInterfacesCount
	pciefunction.networkDeviceFunctions = t.Links.NetworkDeviceFunctions.ToStrings()
	pciefunction.NetworkDeviceFunctionsCount = t.Links.NetworkDeviceFunctionsCount
	pciefunction.pcieDevice = string(t.Links.PCIeDevice)
	pciefunction.storageControllers = t.Links.StorageControllers.ToStrings()
	pciefunction.StorageControllersCount = t.Links.StorageControllersCount
	return nil
}
func GetPCIeFunction(c common.Client, uri string) (*PCIeFunction, error) {
	resp, err := c.Get(uri)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	var pciefunction PCIeFunction
	err = json.NewDecoder(resp.Body).Decode(&pciefunction)
	if err != nil {
		return nil, err
	}
	pciefunction.SetClient(c)
	return &pciefunction, nil
}
func ListReferencedPCIeFunctions(c common.Client, link string) ([]*PCIeFunction, error) {  
	var result []*PCIeFunction
	if link == "" {
		return result, nil
	}
	links, err := common.GetCollection(c, link)
	if err != nil {
		return result, err
	}
	collectionError := common.NewCollectionError()
	for _, pciefunctionLink := range links.ItemLinks {
		pciefunction, err := GetPCIeFunction(c, pciefunctionLink)
		if err != nil {
			collectionError.Failures[pciefunctionLink] = err
		} else {
			result = append(result, pciefunction)
		}
	}
	if collectionError.Empty() {
		return result, nil
	}
	return result, collectionError
}
func (pciefunction *PCIeFunction) Drives() ([]*Drive, error) {
	var result []*Drive
	collectionError := common.NewCollectionError()
	for _, driveLink := range pciefunction.drives {
		drive, err := GetDrive(pciefunction.Client, driveLink)
		if err != nil {
			collectionError.Failures[driveLink] = err
		} else {
			result = append(result, drive)
		}
	}
	if collectionError.Empty() {
		return result, nil
	}
	return result, collectionError
}
func (pciefunction *PCIeFunction) EthernetInterfaces() ([]*EthernetInterface, error) {
	var result []*EthernetInterface
	collectionError := common.NewCollectionError()
	for _, ethLink := range pciefunction.ethernetInterfaces {
		eth, err := GetEthernetInterface(pciefunction.Client, ethLink)
		if err != nil {
			collectionError.Failures[ethLink] = err
		} else {
			result = append(result, eth)
		}
	}
	if collectionError.Empty() {
		return result, nil
	}
	return result, collectionError
}
func (pciefunction *PCIeFunction) NetworkDeviceFunctions() ([]*NetworkDeviceFunction, error) {
	var result []*NetworkDeviceFunction
	collectionError := common.NewCollectionError()
	for _, netLink := range pciefunction.networkDeviceFunctions {
		net, err := GetNetworkDeviceFunction(pciefunction.Client, netLink)
		if err != nil {
			collectionError.Failures[netLink] = err
		} else {
			result = append(result, net)
		}
	}
	if collectionError.Empty() {
		return result, nil
	}
	return result, collectionError
}