Documentation ¶
Index ¶
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func Int(v int) *int
- func StreamToString(stream io.Reader) string
- func String(v string) *string
- type Client
- type ClientOpt
- type ErrorResponse
- type ErrorResponseError
- type Link
- type ListOptions
- type Machine
- type MachineCatalogItem
- type MachineCreateRequest
- type MachineCreateRequestCatalogItemRef
- type MachineCreateRequestOrganization
- type MachineCreateRequestRequestData
- type MachineCreateResponse
- type MachineDataEntry
- type MachineOperation
- type MachineOrganization
- type MachineRequestDataEntry
- type MachineRequestDataEntryValue
- type MachineResourceData
- type MachineResourceTypeRef
- type MachineService
- type MachineServiceOp
- func (svc *MachineServiceOp) CreateMachine(createRequest *MachineCreateRequest) (*Machine, *Response, error)
- func (svc *MachineServiceOp) DestroyMachine(id string) (bool, *Response, error)
- func (svc *MachineServiceOp) GetMachine(id string) (*Machine, *Response, error)
- func (svc *MachineServiceOp) ListMachines(opt *ListOptions) ([]Machine, *Response, error)
- type RequestCompletionCallback
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
func Int ¶
Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it, but unlike Int32 its argument value is an int.
func StreamToString ¶
StreamToString converts a reader to a string
Types ¶
type Client ¶
type Client struct { // Base URL for API requests. BaseURL *url.URL // Username for client Username string // Password for client Password string // Tenant for client Tenant string // Services used for communicating with the API Machine MachineService // contains filtered or unexported fields }
Client manages communication with the vRealize API 6.2
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.
func (*Client) OnRequestCompleted ¶
func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)
OnRequestCompleted sets the DO API request completion callback
type ClientOpt ¶
ClientOpt are options for New.
func SetBaseURL ¶
SetBaseURL is a client option for setting the base URL.
func SetPassword ¶
SetPassword is a client option for setting the Password.
func SetUsername ¶
SetUsername is a client option for setting the Username.
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response Errors []ErrorResponseError `json:"errors"` }
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type ErrorResponseError ¶
type ErrorResponseError struct { Code int `json:"code"` Message string `json:"message"` SystemMessage string `json:"systemMessage"` MoreInfoURL interface{} `json:"moreInfoUrl"` }
ErrorResponseError represents an API error
type ListOptions ¶
type ListOptions struct { // For paginated result sets, page of results to retrieve. Page int `url:"page,omitempty"` // For paginated result sets, the number of results to include per page. Limit int `url:"limit,omitempty"` }
ListOptions specifies the optional parameters to various List methods that support pagination.
type Machine ¶
type Machine struct { ID string `json:"id"` // IconID string `json:"iconId"` ResourceTypeRef MachineResourceTypeRef `json:"resourceTypeRef"` Name string `json:"name"` Description string `json:"description"` Status string `json:"status"` CatalogItem MachineCatalogItem `json:"catalogItem"` RequestID string `json:"requestId"` // ProviderBinding struct { // BindingID string `json:"bindingId"` // ProviderRef struct { // ID string `json:"id"` // Label string `json:"label"` // } `json:"providerRef"` // } `json:"providerBinding"` // Owners []struct { // TenantName string `json:"tenantName"` // Ref string `json:"ref"` // Type string `json:"type"` // Value string `json:"value"` // } `json:"owners"` Organization MachineOrganization `json:"organization"` DateCreated time.Time `json:"dateCreated"` LastUpdated time.Time `json:"lastUpdated"` HasLease bool `json:"hasLease"` // Lease struct { // Start time.Time `json:"start"` // } `json:"lease"` LeaseForDisplay interface{} `json:"leaseForDisplay"` // HasCosts bool `json:"hasCosts"` // Costs struct { // LeaseRate struct { // Type string `json:"type"` // Cost struct { // Type string `json:"type"` // CurrencyCode string `json:"currencyCode"` // Amount float64 `json:"amount"` // } `json:"cost"` // Basis struct { // Type string `json:"type"` // Unit string `json:"unit"` // Amount int `json:"amount"` // } `json:"basis"` // } `json:"leaseRate"` // } `json:"costs"` // CostToDate struct { // Type string `json:"type"` // CurrencyCode string `json:"currencyCode"` // Amount float64 `json:"amount"` // } `json:"costToDate"` // TotalCost interface{} `json:"totalCost"` // ChildResources []interface{} `json:"childResources"` Operations []MachineOperation `json:"operations"` // Forms struct { // CatalogResourceInfoHidden bool `json:"catalogResourceInfoHidden"` // Details struct { // Type string `json:"type"` // ExtensionID string `json:"extensionId"` // ExtensionPointID interface{} `json:"extensionPointId"` // } `json:"details"` // } `json:"forms"` ResourceData MachineResourceData `json:"resourceData"` }
Machine represents a vRealize machine. Commented properties left to be implmented in future.
func (Machine) DestroyActionID ¶
DestroyActionID returns the ID of the Destroy action
func (Machine) MachineName ¶
MachineName returns the name of the machine
func (Machine) ReconfigureActionID ¶
ReconfigureActionID returns the ID of the Reconfigure action
type MachineCatalogItem ¶
type MachineCatalogItem struct {
ID string `json:"id"`
}
MachineCatalogItem represents a catalogueItem
type MachineCreateRequest ¶
type MachineCreateRequest struct { Type string `json:"@type"` CatalogItemRef MachineCreateRequestCatalogItemRef `json:"catalogItemRef"` Organization MachineCreateRequestOrganization `json:"organization"` State string `json:"state"` RequestNumber int `json:"requestNumber"` RequestData MachineCreateRequestRequestData `json:"requestData"` }
MachineCreateRequest represents a request to create a machine
type MachineCreateRequestCatalogItemRef ¶
type MachineCreateRequestCatalogItemRef struct {
ID string `json:"id"`
}
MachineCreateRequestCatalogItemRef represents a catalogItemRef
type MachineCreateRequestOrganization ¶
type MachineCreateRequestOrganization struct { TenantRef string `json:"tenantRef"` SubtenantRef string `json:"subtenantRef"` }
MachineCreateRequestOrganization represents an organization
type MachineCreateRequestRequestData ¶
type MachineCreateRequestRequestData struct {
Entries []MachineRequestDataEntry `json:"entries"`
}
MachineCreateRequestRequestData represents a requestData
type MachineCreateResponse ¶
MachineCreateResponse represents a response to a request to create a machine
func (MachineCreateResponse) String ¶
func (mcr MachineCreateResponse) String() string
type MachineDataEntry ¶
type MachineDataEntry struct { Key string `json:"key"` Value interface{} `json:"value"` }
MachineDataEntry represents a dataEntry
type MachineOperation ¶
type MachineOperation struct { Name string `json:"name"` Description string `json:"description"` IconID string `json:"iconId"` Type string `json:"type"` ID string `json:"id"` ExtensionID string `json:"extensionId"` ProviderTypeID interface{} `json:"providerTypeId"` BindingID interface{} `json:"bindingId"` HasForm bool `json:"hasForm"` FormScale interface{} `json:"formScale"` }
MachineOperation represents an operation
type MachineOrganization ¶
type MachineOrganization struct { TenantRef string `json:"tenantRef"` SubtenantRef string `json:"subtenantRef"` }
MachineOrganization represents an organization
type MachineRequestDataEntry ¶
type MachineRequestDataEntry struct { Key string `json:"key"` Value MachineRequestDataEntryValue `json:"value"` }
MachineRequestDataEntry represents a requestDataEntry
type MachineRequestDataEntryValue ¶
MachineRequestDataEntryValue represents a dataEntryValue
type MachineResourceData ¶
type MachineResourceData struct {
Entries []MachineDataEntry `json:"entries"`
}
MachineResourceData represents resourceData
type MachineResourceTypeRef ¶
MachineResourceTypeRef represents a resourceTypeRef
type MachineService ¶
type MachineService interface { ListMachines(*ListOptions) ([]Machine, *Response, error) GetMachine(string) (*Machine, *Response, error) CreateMachine(*MachineCreateRequest) (*Machine, *Response, error) DestroyMachine(string) (bool, *Response, error) }
MachineService is an interface for interfacing with the storage endpoints of the vRealize API.
type MachineServiceOp ¶
type MachineServiceOp struct {
// contains filtered or unexported fields
}
MachineServiceOp handles communication with the machines related methods of the vRealize API.
func (*MachineServiceOp) CreateMachine ¶
func (svc *MachineServiceOp) CreateMachine(createRequest *MachineCreateRequest) (*Machine, *Response, error)
CreateMachine creates a machine.
func (*MachineServiceOp) DestroyMachine ¶
func (svc *MachineServiceOp) DestroyMachine(id string) (bool, *Response, error)
DestroyMachine Destroys a machine.
func (*MachineServiceOp) GetMachine ¶
func (svc *MachineServiceOp) GetMachine(id string) (*Machine, *Response, error)
GetMachine retrieves an individual machine.
func (*MachineServiceOp) ListMachines ¶
func (svc *MachineServiceOp) ListMachines(opt *ListOptions) ([]Machine, *Response, error)
ListMachines lists all machines.
type RequestCompletionCallback ¶
RequestCompletionCallback defines the type of the request callback function