api

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 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.5.1 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

View Source
const (
	ScicatKeyAuthScopes = "ScicatKeyAuth.Scopes"
)

Variables

This section is empty.

Functions

func GetSwagger

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

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

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 {
	// request a transfer task
	// (POST /transfer)
	PostTransferTask(c *gin.Context, params PostTransferTaskParams)
	// cancels and/or deletes transfer entry
	// (DELETE /transfer/{scicatJobId})
	DeleteTransferTask(c *gin.Context, scicatJobId string, params DeleteTransferTaskParams)
	// 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

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 StrictHandlerFunc

type StrictHandlerFunc = strictgin.StrictGinHandlerFunc

type StrictMiddlewareFunc

type StrictMiddlewareFunc = strictgin.StrictGinMiddlewareFunc

type StrictServerInterface

type StrictServerInterface interface {
	// request a transfer task
	// (POST /transfer)
	PostTransferTask(ctx context.Context, request PostTransferTaskRequestObject) (PostTransferTaskResponseObject, error)
	// cancels and/or deletes transfer entry
	// (DELETE /transfer/{scicatJobId})
	DeleteTransferTask(ctx context.Context, request DeleteTransferTaskRequestObject) (DeleteTransferTaskResponseObject, error)
	// 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