github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/bms/v2/nics/get.go (about)

     1  package nics
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  // Get retrieves a particular nic based on its unique ID.
     9  func Get(c *golangsdk.ServiceClient, serverId string, id string) (*Nic, error) {
    10  	raw, err := c.Get(c.ServiceURL("servers", serverId, "os-interface", id), nil, nil)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	var res Nic
    16  	err = extract.IntoStructPtr(raw.Body, &res, "interfaceAttachment")
    17  	return &res, err
    18  }