-
Notifications
You must be signed in to change notification settings - Fork 8
/
virtual_nic.go
52 lines (46 loc) · 1.4 KB
/
virtual_nic.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package compute
type VirtNICsClient struct {
ResourceClient
}
func (c *ComputeClient) VirtNICs() *VirtNICsClient {
return &VirtNICsClient{
ResourceClient: ResourceClient{
ComputeClient: c,
ResourceDescription: "Virtual NIC",
ContainerPath: "/network/v1/vnic/",
ResourceRootPath: "/network/v1/vnic",
},
}
}
type VirtualNIC struct {
// Description of the object.
Description string `json:"description"`
// MAC address of this VNIC.
MACAddress string `json:"macAddress"`
// The three-part name (/Compute-identity_domain/user/object) of the Virtual NIC.
Name string `json:"name"`
// Tags associated with the object.
Tags []string `json:"tags"`
// True if the VNIC is of type "transit".
TransitFlag bool `json:"transitFlag"`
// Uniform Resource Identifier
Uri string `json:"uri"`
}
// Can only GET a virtual NIC, not update, create, or delete
type GetVirtualNICInput struct {
// The three-part name (/Compute-identity_domain/user/object) of the Virtual NIC.
// Required
Name string `json:"name"`
}
func (c *VirtNICsClient) GetVirtualNIC(input *GetVirtualNICInput) (*VirtualNIC, error) {
var virtNIC VirtualNIC
input.Name = c.getQualifiedName(input.Name)
if err := c.getResource(input.Name, &virtNIC); err != nil {
return nil, err
}
return c.success(&virtNIC)
}
func (c *VirtNICsClient) success(info *VirtualNIC) (*VirtualNIC, error) {
c.unqualify(&info.Name)
return info, nil
}