Documentation
¶
Index ¶
- Constants
- type EntityApi
- func (entityApi *EntityApi) Create(body []byte, options map[string]string) ([]byte, error)
- func (entityApi EntityApi) Delete(id string, body []byte, options map[string]string) ([]byte, error)
- func (entityApi *EntityApi) Execute(id string, operation string, body []byte, options map[string]string) ([]byte, error)
- func (entityApi *EntityApi) Get(id string, options map[string]string) ([]byte, error)
- func (entityApi *EntityApi) List(options map[string]string) ([]byte, error)
- func (entityApi *EntityApi) Update(id string, body []byte, options map[string]string) ([]byte, error)
- type EntityService
- type FailedTask
- type ServiceResources
- type Task
- type TaskApi
- type TaskService
Constants ¶
const ( PENDING = "PENDING" SUCCESS = "SUCCESS" FAILED = "FAILED" )
Task status
const DEFAULT_POLLING_INTERVAL = 1000
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntityApi ¶
type EntityApi struct {
// contains filtered or unexported fields
}
Implementation of the EntityService
func (*EntityApi) Create ¶
Create a new entity described in the body parameter (json object). Returns a []byte (of a json object) that should be unmarshalled to a specific entity
func (EntityApi) Delete ¶
func (entityApi EntityApi) Delete(id string, body []byte, options map[string]string) ([]byte, error)
Delete specified id described. A body (json object) can be provided if some fields must be sent to server. Returns a []byte (of a json object) that should be unmarshalled to a specific entity
func (*EntityApi) Execute ¶
func (entityApi *EntityApi) Execute(id string, operation string, body []byte, options map[string]string) ([]byte, error)
Execute a specific operation on an entity. Returns a []byte (of a json object) that should be unmarshalled to a specific entity
func (*EntityApi) Get ¶
Get an entity. Returns a []byte (of a json object) that should be unmarshalled to a specific entity
type EntityService ¶
type EntityService interface { Get(id string, options map[string]string) ([]byte, error) List(options map[string]string) ([]byte, error) Execute(id string, operation string, body []byte, options map[string]string) ([]byte, error) Create(body []byte, options map[string]string) ([]byte, error) Update(id string, body []byte, options map[string]string) ([]byte, error) Delete(id string, body []byte, options map[string]string) ([]byte, error) }
A generic service to access any entity
func NewEntityService ¶
type FailedTask ¶
type FailedTask Task
func (FailedTask) Error ¶
func (ft FailedTask) Error() string
type ServiceResources ¶
type ServiceResources interface {
GetServiceType() string
}
Holds all the resources available for a particular service
type Task ¶
A Task object. This object can be used to poll asynchronous operations.
type TaskApi ¶
type TaskApi struct {
// contains filtered or unexported fields
}
func (*TaskApi) Poll ¶
Poll an the Task API. Blocks until success or failure. Returns result on success, an error otherwise
func (*TaskApi) PollResponse ¶
func (taskApi *TaskApi) PollResponse(response *api.CcaResponse, milliseconds time.Duration) ([]byte, error)
Poll an the Task API. Blocks until success or failure
type TaskService ¶
type TaskService interface { Get(id string) (*Task, error) Poll(id string, milliseconds time.Duration) ([]byte, error) PollResponse(response *api.CcaResponse, milliseconds time.Duration) ([]byte, error) }
func NewTaskService ¶
func NewTaskService(apiClient api.ApiClient) TaskService
Create a new TaskService