restapi

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 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"
	DeleteDesignEndPoint = "DELETE_DESIGN"

	// Keys for design schema endpoints
	CreateDesignSchemaEndPoint = "CREATE_DESIGN_SCHEMA"
	GetDesignSchemaEndPoint    = "GET_DESIGN_SCHEMA"
	UpdateDesignSchemaEndPoint = "UPDATE_DESIGN_SCHEMA"
	DeleteDesignSchemaEndPoint = "DELETE_DESIGN_SCHEMA"

	// Keys for design code endpoints
	CreateDesignCodeEndPoint      = "CREATE_DESIGN_CODE"
	GetDesignCodeEndPoint         = "GET_DESIGN_CODE"
	UpdateDesignCodeEndPoint      = "UPDATE_DESIGN_CODE"
	DeleteDesignCodeEndPoint      = "DELETE_DESIGN_CODE"
	GetDesignCodeRevisionEndPoint = "GET_DESIGN_CODE_REVISION"

	// Keys for job endpoints
	CreateJobEndpoint        = "CREATE_JOB"
	GetJobEndPoint           = "GET_JOB"
	GetJobsEndPoint          = "GET_JOBS"
	GetJobsByComputeEndPoint = "GET_JOBS_BY_COMPUTE"
	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}}",
	DeleteDesignEndPoint: "/users/{{.user}}/designs/{{.designId}}",

	CreateDesignSchemaEndPoint: "/users/{{.user}}/designs/{{.designId}}/schema",
	GetDesignSchemaEndPoint:    "/users/{{.user}}/designs/{{.designId}}/schema",
	UpdateDesignSchemaEndPoint: "/users/{{.user}}/designs/{{.designId}}/schema",
	DeleteDesignSchemaEndPoint: "/users/{{.user}}/designs/{{.designId}}/schema",

	CreateDesignCodeEndPoint:      "/users/{{.user}}/designs/{{.designId}}/code",
	GetDesignCodeEndPoint:         "/users/{{.user}}/designs/{{.designId}}/code",
	UpdateDesignCodeEndPoint:      "/users/{{.user}}/designs/{{.designId}}/code",
	DeleteDesignCodeEndPoint:      "/users/{{.user}}/designs/{{.designId}}/code",
	GetDesignCodeRevisionEndPoint: "/users/{{.user}}/designs/{{.designId}}/code/revision",

	GetJobsByComputeEndPoint: "/jobs/{{.computeId}}",
	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}}&generic={{.generic}}",
	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