api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: BSD-3-Clause Imports: 35 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Collect type-safe template types

Index

Constants

View Source
const SCICAT_AUTH_HEADER = "SciCat-API-Key"

HTTP header to specify SciCat API key

Variables

This section is empty.

Functions

func GetSpec added in v0.5.3

func GetSpec() (swagger *openapi3.T, err error)

GetSpec returns the OpenAPI specification corresponding to the generated code in this file. External references in the spec are resolved through PathToRawSpec; externally-referenced files must be embedded in their corresponding Go packages (via the import-mapping feature). URL-based external refs are not supported.

func GetSpecJSON added in v0.5.3

func GetSpecJSON() ([]byte, error)

GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI specification: decompressed but not unmarshaled. External references are not resolved here; the bytes are the spec exactly as embedded by codegen. The result is cached at package init time, so repeated calls are cheap.

func GetSwagger deprecated

func GetSwagger() (*openapi3.T, error)

GetSwagger returns the OpenAPI specification corresponding to the generated code in this file.

Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger to openapi3.T. Use GetSpec instead. This wrapper is retained for backwards compatibility.

func NewServer

func NewServer(api *ServerHandler, port uint, scicatUrl string) (*http.Server, error)

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

func ScicatTokenAuthMiddleware

func ScicatTokenAuthMiddleware(scicatUrl string) openapi3filter.AuthenticationFunc

Types

type DeleteTransferTask200Response

type DeleteTransferTask200Response struct {
}

func (DeleteTransferTask200Response) VisitDeleteTransferTaskResponse

func (response DeleteTransferTask200Response) VisitDeleteTransferTaskResponse(w http.ResponseWriter) error

type DeleteTransferTask400JSONResponse

type DeleteTransferTask400JSONResponse struct {
	GeneralErrorResponseJSONResponse
}

func (DeleteTransferTask400JSONResponse) VisitDeleteTransferTaskResponse

func (response DeleteTransferTask400JSONResponse) VisitDeleteTransferTaskResponse(w http.ResponseWriter) error

type DeleteTransferTask401JSONResponse

type DeleteTransferTask401JSONResponse struct {
	// Details further details, debugging information
	Details *string `json:"details,omitempty"`

	// Message the error message
	Message *string `json:"message,omitempty"`
}

func (DeleteTransferTask401JSONResponse) VisitDeleteTransferTaskResponse

func (response DeleteTransferTask401JSONResponse) VisitDeleteTransferTaskResponse(w http.ResponseWriter) error

type DeleteTransferTask403JSONResponse

type DeleteTransferTask403JSONResponse struct {
	// Details further details, debugging information
	Details *string `json:"details,omitempty"`

	// Message the error message
	Message *string `json:"message,omitempty"`
}

func (DeleteTransferTask403JSONResponse) VisitDeleteTransferTaskResponse

func (response DeleteTransferTask403JSONResponse) VisitDeleteTransferTaskResponse(w http.ResponseWriter) error

type DeleteTransferTask500JSONResponse

type DeleteTransferTask500JSONResponse struct {
	// Details further details, debugging information
	Details *string `json:"details,omitempty"`

	// Message the error message
	Message *string `json:"message,omitempty"`
}

func (DeleteTransferTask500JSONResponse) VisitDeleteTransferTaskResponse

func (response DeleteTransferTask500JSONResponse) VisitDeleteTransferTaskResponse(w http.ResponseWriter) error

type DeleteTransferTaskParams

type DeleteTransferTaskParams struct {
	// Delete Enables/disables deleting from scicat job system. By default, it's disabled (false).
	Delete *bool `form:"delete,omitempty" json:"delete,omitempty"`
}

DeleteTransferTaskParams defines parameters for DeleteTransferTask.

type DeleteTransferTaskRequestObject

type DeleteTransferTaskRequestObject struct {
	ScicatJobId string `json:"scicatJobId"`
	Params      DeleteTransferTaskParams
}

type DeleteTransferTaskResponseObject

type DeleteTransferTaskResponseObject interface {
	VisitDeleteTransferTaskResponse(w http.ResponseWriter) error
}

type Facility

type Facility struct {
	Name            string
	Collection      string
	AccessPath      *accessPathTemplate
	AccessValue     *accessPathTemplate
	Direction       config.FacilityDirection
	SourcePath      *facilityPathTemplate
	DestinationPath *facilityPathTemplate
}

func NewFacility

func NewFacility(config config.FacilityConfig) (*Facility, error)

type FileToTransfer

type FileToTransfer struct {
	// IsSymlink specifies whether this file is a symlink
	IsSymlink bool `json:"isSymlink"`

	// Path the path of the file, it has to be relative to the dataset source folder
	Path string `json:"path"`
}

FileToTransfer the file to transfer as part of a transfer request

type GeneralErrorResponse

type GeneralErrorResponse struct {
	// Details further details, debugging information
	Details *string `json:"details,omitempty"`

	// Message the error message
	Message *string `json:"message,omitempty"`
}

GeneralErrorResponse defines model for GeneralErrorResponse.

type GeneralErrorResponseJSONResponse

type GeneralErrorResponseJSONResponse struct {
	// Details further details, debugging information
	Details *string `json:"details,omitempty"`

	// Message the error message
	Message *string `json:"message,omitempty"`
}

type GetVersion200JSONResponse

type GetVersion200JSONResponse struct {
	// Version the current version of the service
	Version string `json:"version"`
}

func (GetVersion200JSONResponse) VisitGetVersionResponse

func (response GetVersion200JSONResponse) VisitGetVersionResponse(w http.ResponseWriter) error

type GetVersionRequestObject

type GetVersionRequestObject struct {
}

type GetVersionResponseObject

type GetVersionResponseObject interface {
	VisitGetVersionResponse(w http.ResponseWriter) error
}

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type PostTransferTask200JSONResponse

type PostTransferTask200JSONResponse struct {
	// JobId the SciCat job id of the transfer job
	JobId string `json:"jobId"`
}

func (PostTransferTask200JSONResponse) VisitPostTransferTaskResponse

func (response PostTransferTask200JSONResponse) VisitPostTransferTaskResponse(w http.ResponseWriter) error

type PostTransferTask400JSONResponse

type PostTransferTask400JSONResponse struct {
	GeneralErrorResponseJSONResponse
}

func (PostTransferTask400JSONResponse) VisitPostTransferTaskResponse

func (response PostTransferTask400JSONResponse) VisitPostTransferTaskResponse(w http.ResponseWriter) error

type PostTransferTask401JSONResponse

type PostTransferTask401JSONResponse struct {
	// Details further details, debugging information
	Details *string `json:"details,omitempty"`

	// Message the error message
	Message *string `json:"message,omitempty"`
}

func (PostTransferTask401JSONResponse) VisitPostTransferTaskResponse

func (response PostTransferTask401JSONResponse) VisitPostTransferTaskResponse(w http.ResponseWriter) error

type PostTransferTask403JSONResponse

type PostTransferTask403JSONResponse struct {
	// Details further details, debugging information
	Details *string `json:"details,omitempty"`

	// Message the error message
	Message *string `json:"message,omitempty"`
}

func (PostTransferTask403JSONResponse) VisitPostTransferTaskResponse

func (response PostTransferTask403JSONResponse) VisitPostTransferTaskResponse(w http.ResponseWriter) error

type PostTransferTask500JSONResponse

type PostTransferTask500JSONResponse struct {
	// Details further details, debugging information
	Details *string `json:"details,omitempty"`

	// Message the error message
	Message *string `json:"message,omitempty"`
}

func (PostTransferTask500JSONResponse) VisitPostTransferTaskResponse

func (response PostTransferTask500JSONResponse) VisitPostTransferTaskResponse(w http.ResponseWriter) error

type PostTransferTask503JSONResponse

type PostTransferTask503JSONResponse struct {
	// Details further details, debugging information
	Details *string `json:"details,omitempty"`

	// Message the error message
	Message *string `json:"message,omitempty"`
}

func (PostTransferTask503JSONResponse) VisitPostTransferTaskResponse

func (response PostTransferTask503JSONResponse) VisitPostTransferTaskResponse(w http.ResponseWriter) error

type PostTransferTaskJSONBody

type PostTransferTaskJSONBody struct {
	FileList *[]FileToTransfer `json:"fileList,omitempty"`
}

PostTransferTaskJSONBody defines parameters for PostTransferTask.

type PostTransferTaskJSONRequestBody

type PostTransferTaskJSONRequestBody PostTransferTaskJSONBody

PostTransferTaskJSONRequestBody defines body for PostTransferTask for application/json ContentType.

type PostTransferTaskParams

type PostTransferTaskParams struct {
	// SourceFacility the identifier name of the source facility
	SourceFacility string `form:"sourceFacility" json:"sourceFacility"`

	// DestFacility the path in the destination collection to use for the transfer
	DestFacility string `form:"destFacility" json:"destFacility"`

	// ScicatPid the pid of the dataset being transferred
	ScicatPid string `form:"scicatPid" json:"scicatPid"`

	// CollectionRootPath Path to the root of the globus collection on the source facility
	CollectionRootPath string `form:"collectionRootPath" json:"collectionRootPath"`

	// AutoArchive start archive job after successful transfer
	AutoArchive *bool `form:"autoArchive,omitempty" json:"autoArchive,omitempty"`
}

PostTransferTaskParams defines parameters for PostTransferTask.

type PostTransferTaskRequestObject

type PostTransferTaskRequestObject struct {
	Params PostTransferTaskParams
	Body   *PostTransferTaskJSONRequestBody
}

type PostTransferTaskResponseObject

type PostTransferTaskResponseObject interface {
	VisitPostTransferTaskResponse(w http.ResponseWriter) error
}

type ServerHandler

type ServerHandler struct {
	// contains filtered or unexported fields
}

func NewServerHandler

func NewServerHandler(
	version string,
	globusClient globus.GlobusClient,
	scicatUrl string,
	scicatServiceUser serviceuser.ScicatServiceUser,
	facilities *map[string]Facility,
	taskPool tasks.TaskPool) (ServerHandler, error)

func (ServerHandler) GetVersion

func (ServerHandler) PostTransferTask

type ServerInterface

type ServerInterface interface {
	// PostTransferTask request a transfer task
	// (POST /transfer)
	PostTransferTask(c *gin.Context, params PostTransferTaskParams)
	// DeleteTransferTask cancels and/or deletes transfer entry
	// (DELETE /transfer/{scicatJobId})
	DeleteTransferTask(c *gin.Context, scicatJobId string, params DeleteTransferTaskParams)
	// GetVersion get SciCat Globus Proxy version
	// (GET /version)
	GetVersion(c *gin.Context)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions added in v0.5.3

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictGinServerOptions) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) DeleteTransferTask

func (siw *ServerInterfaceWrapper) DeleteTransferTask(c *gin.Context)

DeleteTransferTask operation middleware

func (*ServerInterfaceWrapper) GetVersion

func (siw *ServerInterfaceWrapper) GetVersion(c *gin.Context)

GetVersion operation middleware

func (*ServerInterfaceWrapper) PostTransferTask

func (siw *ServerInterfaceWrapper) PostTransferTask(c *gin.Context)

PostTransferTask operation middleware

type StrictGinServerOptions added in v0.5.3

type StrictGinServerOptions struct {
	// RequestErrorHandlerFunc is called when a request cannot be parsed or
	// decoded. It is invoked for JSON bind failures, form parse/bind errors,
	// multipart reader errors, media type parse errors, missing multipart
	// boundaries, and request body read errors. The default returns 400.
	RequestErrorHandlerFunc func(ctx *gin.Context, err error)
	// HandlerErrorFunc is called when the application handler (or any
	// middleware wrapping it) returns a non-nil error. The default returns 500.
	HandlerErrorFunc func(ctx *gin.Context, err error)
	// ResponseErrorHandlerFunc is called when the response object fails to
	// serialize (Visit*Response returns an error) or when the handler returns
	// an unexpected response type. The default returns 500.
	ResponseErrorHandlerFunc func(ctx *gin.Context, err error)
}

type StrictHandlerFunc

type StrictHandlerFunc func(ctx *gin.Context, request any) (any, error)

type StrictMiddlewareFunc

type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc

type StrictServerInterface

type StrictServerInterface interface {
	// PostTransferTask request a transfer task
	// (POST /transfer)
	PostTransferTask(ctx context.Context, request PostTransferTaskRequestObject) (PostTransferTaskResponseObject, error)
	// DeleteTransferTask cancels and/or deletes transfer entry
	// (DELETE /transfer/{scicatJobId})
	DeleteTransferTask(ctx context.Context, request DeleteTransferTaskRequestObject) (DeleteTransferTaskResponseObject, error)
	// GetVersion get SciCat Globus Proxy version
	// (GET /version)
	GetVersion(ctx context.Context, request GetVersionRequestObject) (GetVersionResponseObject, error)
}

StrictServerInterface represents all server handlers.

Jump to

Keyboard shortcuts

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