Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultClient() (client *http.Client)
- type ErrorElem
- type QueryResultRecords
- type TaskElem
- type TasksElem
- type VApp
- type VAppTemplateRecord
- type VCDClient
- func (s *VCDClient) Auth(username, password string) (err error)
- func (s *VCDClient) AuthDecorate(req *http.Request) (err error)
- func (s *VCDClient) DeleteVApp(vappID string) (task *TaskElem, err error)
- func (s *VCDClient) DeployVApp(templateName, templateHref, vcdHref string) (vapp *VApp, err error)
- func (s *VCDClient) PollTaskURL(taskURL string) (task *TaskElem, err error)
- func (s *VCDClient) QueryTemplate(templateName string) (vappTemplate *VAppTemplateRecord, err error)
- func (s *VCDClient) UnDeployVApp(vappID string) (task *TaskElem, err error)
Constants ¶
const ( //VCloudTokenHeaderName - response header name for the auth token VCloudTokenHeaderName = "X-Vcloud-Authorization" //AuthSuccessStatusCode - status code expected for a successful auth call to the vcd api AuthSuccessStatusCode = 200 //QuerySuccessStatusCode - a query call to vcd api was successful QuerySuccessStatusCode = 200 //DeployVappSuccessStatusCode - successful status code for vapp deploy DeployVappSuccessStatusCode = 201 //DeleteVappSuccessStatusCode - successful status code for vapp delete DeleteVappSuccessStatusCode = 201 //TaskPollSuccessStatusCode - successfull statuscode on a call to the task api endpoint TaskPollSuccessStatusCode = 200 //TaskStatusQueued (The task has been queued for execution.), TaskStatusQueued = "queued" //TaskStatusPreRunning (The task is awaiting preprocessing or, if it is a blocking task, administrative action.), TaskStatusPreRunning = "preRunning" //TaskStatusRunning (The task is runnning.), TaskStatusRunning = "running" //TaskStatusSuccess (The task completed with a status of success.), TaskStatusSuccess = "success" //TaskStatusError (The task encountered an error while running.), TaskStatusError = "error" //TaskStatusCanceled (The task was canceled by the owner or an administrator.), TaskStatusCanceled = "canceled" //TaskStatusAborted (The task was aborted by an administrative action.) TaskStatusAborted = "aborted" )
Variables ¶
var ( //ErrAuthFailure - error message returned for authentication responses not having a success statuscode ErrAuthFailure = errors.New("status code failure on authentication call to api") //ErrNoTokenToApply - error when there is no auth token ErrNoTokenToApply = errors.New("no token to decorate the given request with") //ErrFailedQuery - query to vcd api failed returning non 200 status code ErrFailedQuery = errors.New("invalid response code from query api call") //ErrFailedDeploy - deploy api call returned a non-success statuscode ErrFailedDeploy = errors.New("invalid response code from deploy api call") //ErrTaskResponseParseFailed - cant call task poll rest api endpoint ErrTaskResponseParseFailed = errors.New("failed to poll task status code not successful") )
Functions ¶
func DefaultClient ¶
DefaultClient - grabs a default http client for us to use for api calls
Types ¶
type ErrorElem ¶ added in v0.0.38
type ErrorElem struct { Message string MajorErrorCode int MinorErrorCode string VendorSpecificErrorCode string StackTrace string }
ErrorElem - an error xml object
type QueryResultRecords ¶
type QueryResultRecords struct { XMLName xml.Name `xml:"QueryResultRecords"` VAppTemplateRecord []VAppTemplateRecord `xml:"VAppTemplateRecord"` Link []interface{} `xml:"Link"` }
QueryResultRecords - root level query result xml object
type TaskElem ¶ added in v0.0.37
type TaskElem struct { //Href Href string `xml:"href,attr"` //Status Status string `xml:"status,attr"` //StartTime StartTime time.Time `xml:"startTime,attr"` Error ErrorElem `xml:"Error"` }
TaskElem - object representing a XML task response object from the api
type TasksElem ¶ added in v0.0.37
type TasksElem struct {
Task TaskElem `xml:"Task"`
}
TasksElem ----
type VApp ¶ added in v0.0.37
type VApp struct { //XMLName XMLName xml.Name `xml:"VApp"` //Link Link []interface{} `xml:"Link"` //Description Description string `xml:"Description"` //Tasks Tasks TasksElem `xml:"Tasks"` //Files Files []interface{} `xml:"Files"` //VAppParent VAppParent interface{} `xml:"VAppParent"` //Owner Owner interface{} `xml:"Owner"` //InMaintenanceMode InMaintenanceMode bool `xml:"InMaintenanceMode"` //Children Children []interface{} `xml:"Children"` }
VApp - xml object used in response from deploy app api call
type VAppTemplateRecord ¶
type VAppTemplateRecord struct { //VdcName VdcName string `xml:"vdcName,attr"` //Vdc Vdc string `xml:"vdc,attr"` //StorageProfileName StorageProfileName string `xml:"storageProfileName,attr"` //Status Status string `xml:"status,attr"` //OwnerName OwnerName string `xml:"ownerName,attr"` //Org Org string `xml:"org,attr"` //Name Name string `xml:"name,attr"` //IsPublished IsPublished bool `xml:"isPublished,attr"` //IsGoldMaster IsGoldMaster bool `xml:"isGoldMaster,attr"` //IsExpired IsExpired bool `xml:"isExpired,attr"` //IsEnabled IsEnabled bool `xml:"isEnabled,attr"` //IsDeployed IsDeployed bool `xml:"isDeployed,attr"` //IsBusy IsBusy bool `xml:"isBusy,attr"` //CreationDate CreationDate time.Time `xml:"creationDate,attr"` //CatalogName CatalogName string `xml:"catalogName,attr"` //Href Href string `xml:"href,attr"` //IsInCatalog IsInCatalog bool `xml:"isInCatalog,attr"` //CpuAllocationMhz CpuAllocationMhz float64 `xml:"cpuAllocationMhz,attr"` //CpuAllocationInMhz CpuAllocationInMhz float64 `xml:"cpuAllocationInMhz,attr"` //Task Task string `xml:"task,attr"` //NumberOfShadowVMs NumberOfShadowVMs float64 `xml:"numberOfShadowVMs,attr"` //AutoDeleteDate AutoDeleteDate time.Time `xml:"autoDeleteDate,attr"` //IsAutoDeleteNotified IsAutoDeleteNotified bool `xml:"isAutoDeleteNotified,attr"` //NumberOfVMs NumberOfVMs float64 `xml:"numberOfVMs,attr"` //IsAutoUndeployNotified IsAutoUndeployNotified bool `xml:"isAutoUndeployNotified,attr"` //TaskStatusName TaskStatusName string `xml:"taskStatusName,attr"` //IsVdcEnabled IsVdcEnabled bool `xml:"isVdcEnabled,attr"` //HonorBootOrder HonorBootOrder bool `xml:"honorBootOrder,attr"` //TaskStatus TaskStatus string `xml:"taskStatus,attr"` //StorageKB StorageKB float64 `xml:"storageKB,attr"` //TaskDetails TaskDetails string `xml:"taskDetails,attr"` //NumberOfCpus NumberOfCpus float64 `xml:"numberOfCpus,attr"` //MemoryAllocationMB MemoryAllocationMB float64 `xml:"memoryAllocationMB,attr"` }
VAppTemplateRecord - vapp result from query
type VCDClient ¶
type VCDClient struct { //BaseURI BaseURI string //Token Token string // contains filtered or unexported fields }
VCDClient - vcd authentication object
func NewVCDClient ¶
NewVCDClient - constructs a new VCDClient object with given client
func (*VCDClient) AuthDecorate ¶
AuthDecorate - decorate a given request object with a auth token header
func (*VCDClient) DeleteVApp ¶ added in v0.0.41
DeleteVApp - this will make a delete api call for the given vapp
func (*VCDClient) DeployVApp ¶ added in v0.0.36
DeployVApp - deploy a vapptemplate as a vapp to a given slot
func (*VCDClient) PollTaskURL ¶ added in v0.0.38
PollTaskURL - given a task url this will poll it for status, up to a timeout, and take a success or fail action
func (*VCDClient) QueryTemplate ¶ added in v0.0.34
func (s *VCDClient) QueryTemplate(templateName string) (vappTemplate *VAppTemplateRecord, err error)
QueryTemplate - query the vcd api for the template we would like to use