Implements a new Packer builder (oracle-bmcs) which adds support for building custom images for Oracle Bare Metal Cloud Services (BMCS) https://cloud.oracle.com/en_US/bare-metal. Additionally includes documentation for the oracle-bmcs builder.
54 lines
1.6 KiB
Go
54 lines
1.6 KiB
Go
// Copyright (c) 2017 Oracle America, Inc.
|
|
// The contents of this file are subject to the Mozilla Public License Version
|
|
// 2.0 (the "License"); you may not use this file except in compliance with the
|
|
// License. If a copy of the MPL was not distributed with this file, You can
|
|
// obtain one at http://mozilla.org/MPL/2.0/
|
|
|
|
package bmcs
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// VNICService enables communicating with the BMCS compute API's VNICs
|
|
// endpoint.
|
|
type VNICService struct {
|
|
client *baseClient
|
|
}
|
|
|
|
// NewVNICService creates a new VNICService for communicating with the
|
|
// BMCS compute API's instance related endpoints.
|
|
func NewVNICService(s *baseClient) *VNICService {
|
|
return &VNICService{client: s.New().Path("vnics/")}
|
|
}
|
|
|
|
// VNIC - a virtual network interface card.
|
|
type VNIC struct {
|
|
AvailabilityDomain string `json:"availabilityDomain"`
|
|
CompartmentID string `json:"compartmentId"`
|
|
DisplayName string `json:"displayName,omitempty"`
|
|
ID string `json:"id"`
|
|
LifecycleState string `json:"lifecycleState"`
|
|
PrivateIP string `json:"privateIp"`
|
|
PublicIP string `json:"publicIp"`
|
|
SubnetID string `json:"subnetId"`
|
|
TimeCreated time.Time `json:"timeCreated"`
|
|
}
|
|
|
|
// GetVNICParams are the paramaters available when communicating with the
|
|
// ListVNICs API endpoint.
|
|
type GetVNICParams struct {
|
|
ID string `url:"vnicId"`
|
|
}
|
|
|
|
// Get returns an individual VNIC.
|
|
func (s *VNICService) Get(params *GetVNICParams) (VNIC, error) {
|
|
VNIC := &VNIC{}
|
|
e := &APIError{}
|
|
|
|
_, err := s.client.New().Get(params.ID).Receive(VNIC, e)
|
|
err = firstError(err, e)
|
|
|
|
return *VNIC, err
|
|
}
|