restapi

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Keys for dataset endpoints
	CreateDatasetEndPoint  = "CREATE_DATASET"
	GetDatasetEndPoint     = "GET_DATASET"
	GetDatasetsEndPoint    = "GET_DATASETS"
	GetAllDatasetsEndPoint = "GET_ALL_DATASETS"

	// Keys for design endpoints
	CreateDesignEndPoint = "CREATE_DESIGN"
	GetDesignsEndPoint   = "GET_DESIGNS"
	GetDesignEndPoint    = "GET_DESIGN"

	// Keys for design schema endpoints
	CreateDesignSchemaEndPoint = "CREATE_DESIGN_SCHEMA"
	GetDesignSchemaEndPoint    = "GET_DESIGN_SCHEMA"
	GetDesignSchemasEndPoint   = "GET_DESIGN_SCHEMAS"
	UpdateDesignSchemaEndPoint = "UPDATE_DESIGN_SCHEMA"

	// Keys for design code endpoints
	CreateDesignCodeEndPoint = "CREATE_DESIGN_CODE"
	GetDesignCodeEndPoint    = "GET_DESIGN_CODE"
	UpdateDesignCodeEndPoint = "UPDATE_DESIGN_CODE"

	// Keys for job endpoints
	CreateJobEndpoint       = "CREATE_JOB"
	GetJobEndPoint          = "GET_JOB"
	GetJobsEndPoint         = "GET_JOBS"
	GetJobStatusEndPoint    = "GET_JOB_STATUS"
	GetTasksInfoEndpoint    = "GET_TASKS_INFO"
	GetTaskInfoEndpoint     = "GET_TASK_INFO"
	DeleteJobEndPoint       = "DELETE_JOB"
	UpdateJobEndPoint       = "UPDATE_JOB"
	ChangeJobSchemaEndPoint = "CHANGE_SCHEMA_JOB"
	UpdateJobStatusEndPoint = "UPDATE_JOB_STATUS"

	// Keys for task
	GetTaskEndpoint          = "GET_TASK"
	UpdateTaskStatusEndPoint = "UPDATE_TASK_STATUS"

	// Keys for computes endpoints
	RegisterComputeEndpoint     = "REGISTER_COMPUTE"
	GetComputeStatusEndpoint    = "GET_COMPUTE_STATUS"
	UpdateComputeEndpoint       = "UPDATE_COMPUTE"
	DeleteComputeEndpoint       = "DELETE_COMPUTE"
	GetComputeConfigEndpoint    = "GET_COMPUTE_CONFIG"
	GetDeploymentsEndpoint      = "GET_DEPLOYMENTS"
	GetDeploymentConfigEndpoint = "GET_DEPLOYMENT_CONFIG"
	PutDeploymentStatusEndpoint = "PUT_DEPLOYMENT_STATUS"
	GetDeploymentStatusEndpoint = "GET_DEPLOYMENT_STATUS"
)

Variables

View Source
var URI = map[string]string{

	CreateDatasetEndPoint:  "/users/{{.user}}/datasets",
	GetDatasetEndPoint:     "/users/{{.user}}/datasets/{{.datasetId}}",
	GetDatasetsEndPoint:    "/users/{{.user}}/datasets/?limit={{.limit}}",
	GetAllDatasetsEndPoint: "/datasets/?limit={{.limit}}",

	CreateDesignEndPoint: "/users/{{.user}}/designs",
	GetDesignEndPoint:    "/users/{{.user}}/designs/{{.designId}}",
	GetDesignsEndPoint:   "/users/{{.user}}/designs/?limit={{.limit}}",

	CreateDesignSchemaEndPoint: "/users/{{.user}}/designs/{{.designId}}/schemas",
	GetDesignSchemaEndPoint:    "/users/{{.user}}/designs/{{.designId}}/schemas/{{.version}}",
	GetDesignSchemasEndPoint:   "/users/{{.user}}/designs/{{.designId}}/schemas",
	UpdateDesignSchemaEndPoint: "/users/{{.user}}/designs/{{.designId}}/schemas/{{.version}}",

	CreateDesignCodeEndPoint: "/users/{{.user}}/designs/{{.designId}}/codes",
	GetDesignCodeEndPoint:    "/users/{{.user}}/designs/{{.designId}}/codes/{{.version}}",
	UpdateDesignCodeEndPoint: "/users/{{.user}}/designs/{{.designId}}/codes/{{.version}}",

	CreateJobEndpoint:       "/users/{{.user}}/jobs",
	GetJobEndPoint:          "/users/{{.user}}/jobs/{{.jobId}}",
	GetJobsEndPoint:         "/users/{{.user}}/jobs/?limit={{.limit}}",
	GetJobStatusEndPoint:    "/users/{{.user}}/jobs/{{.jobId}}/status",
	GetTasksInfoEndpoint:    "/users/{{.user}}/jobs/{{.jobId}}/tasks/?limit={{.limit}}",
	GetTaskInfoEndpoint:     "/users/{{.user}}/jobs/{{.jobId}}/tasks/{{.taskId}}",
	UpdateJobEndPoint:       "/users/{{.user}}/jobs/{{.jobId}}",
	DeleteJobEndPoint:       "/users/{{.user}}/jobs/{{.jobId}}",
	ChangeJobSchemaEndPoint: "/users/{{.user}}/jobs/{{.jobId}}/schema/{{.schemaId}}/design/{{.designId}}",
	UpdateJobStatusEndPoint: "/users/{{.user}}/jobs/{{.jobId}}/status",

	GetTaskEndpoint:          "/jobs/{{.jobId}}/{{.taskId}}/task/?key={{.key}}",
	UpdateTaskStatusEndPoint: "/jobs/{{.jobId}}/{{.taskId}}/task/status",

	RegisterComputeEndpoint:     "/computes",
	GetComputeStatusEndpoint:    "/computes/{{.computeId}}",
	UpdateComputeEndpoint:       "/computes/{{.computeId}}",
	DeleteComputeEndpoint:       "/computes/{{.computeId}}",
	GetComputeConfigEndpoint:    "/computes/{{.computeId}}/config",
	GetDeploymentsEndpoint:      "/computes/{{.computeId}}/deployments",
	GetDeploymentConfigEndpoint: "/computes/{{.computeId}}/deployments/{{.jobId}}/config",
	PutDeploymentStatusEndpoint: "/computes/{{.computeId}}/deployments/{{.jobId}}/status",
	GetDeploymentStatusEndpoint: "/computes/{{.computeId}}/deployments/{{.jobId}}/status",
}

Functions

func CheckStatusCode

func CheckStatusCode(code int) error

func CreateMultipartFormData

func CreateMultipartFormData(kv map[string]io.Reader) (*bytes.Buffer, *multipart.Writer, error)

func CreateURL

func CreateURL(hostEndpoint string, endPoint string, inputMap map[string]string) string

func ErrorNilCheck

func ErrorNilCheck(method string, err error) error

ErrorNilCheck logger function to avoid re-writing the checks

func FromTemplate

func FromTemplate(skeleton string, inputMap map[string]string) (string, error)

func GetFunctionName

func GetFunctionName(i interface{}) string

func HTTPDelete added in v0.1.3

func HTTPDelete(url string, msg interface{}, contentType string) (int, []byte, error)

func HTTPGet

func HTTPGet(url string) (int, []byte, error)

func HTTPGetMultipart

func HTTPGetMultipart(url string) (int, map[string][]byte, error)

func HTTPPost

func HTTPPost(url string, msg interface{}, contentType string) (int, []byte, error)

func HTTPPut

func HTTPPut(url string, msg interface{}, contentType string) (int, []byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL