github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/builder/oracle/oci/client/vnic.go (about) 1 package oci 2 3 import ( 4 "time" 5 ) 6 7 // VNICService enables communicating with the OCI compute API's VNICs 8 // endpoint. 9 type VNICService struct { 10 client *baseClient 11 } 12 13 // NewVNICService creates a new VNICService for communicating with the 14 // OCI compute API's instance related endpoints. 15 func NewVNICService(s *baseClient) *VNICService { 16 return &VNICService{client: s.New().Path("vnics/")} 17 } 18 19 // VNIC - a virtual network interface card. 20 type VNIC struct { 21 AvailabilityDomain string `json:"availabilityDomain"` 22 CompartmentID string `json:"compartmentId"` 23 DisplayName string `json:"displayName,omitempty"` 24 ID string `json:"id"` 25 LifecycleState string `json:"lifecycleState"` 26 PrivateIP string `json:"privateIp"` 27 PublicIP string `json:"publicIp"` 28 SubnetID string `json:"subnetId"` 29 TimeCreated time.Time `json:"timeCreated"` 30 } 31 32 // GetVNICParams are the paramaters available when communicating with the 33 // ListVNICs API endpoint. 34 type GetVNICParams struct { 35 ID string `url:"vnicId"` 36 } 37 38 // Get returns an individual VNIC. 39 func (s *VNICService) Get(params *GetVNICParams) (VNIC, error) { 40 VNIC := &VNIC{} 41 e := &APIError{} 42 43 _, err := s.client.New().Get(params.ID).Receive(VNIC, e) 44 err = firstError(err, e) 45 46 return *VNIC, err 47 }