api

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: BSD-3-Clause Imports: 29 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.4.1 DO NOT EDIT.

Index

Constants

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) gin.HandlerFunc

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 DestinationTemplate

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

func NewDestinationTemplate

func NewDestinationTemplate(templateString string) (DestinationTemplate, error)

func (*DestinationTemplate) Execute

func (dt *DestinationTemplate) Execute(data destPathParams) (string, 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 GeneralError

type GeneralError struct {
	Message string `json:"message"`
	Details string `json:"details"`
}

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 GinServerOptions

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

GinServerOptions provides options for the Gin server.

type GroupTemplateData

type GroupTemplateData struct {
	FacilityName string
}

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"`
}

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 ScicatDataset

type ScicatDataset struct {
	OwnerGroup   string `json:"ownerGroup"`
	SourceFolder string `json:"sourceFolder"`
}

type ServerHandler

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

func NewServerHandler

func NewServerHandler(globusClient globus.GlobusClient, scopes []string, scicatUrl string, scicatServiceUser serviceuser.ScicatServiceUser, facilityCollectionIDs map[string]string, srcGroupTemplateBody string, dstGroupTemplateBody string, dstPathTemplateBody string, taskPool tasks.TaskPool) (ServerHandler, error)

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)
}

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) 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)
}

StrictServerInterface represents all server handlers.

type User

type User struct {
	ID           string `json:"id"`
	AuthStrategy string `json:"authStrategy"`
	ExternalID   string `json:"externalId"`
	Profile      struct {
		DisplayName    string `json:"displayName"`
		Email          string `json:"email"`
		Username       string `json:"username"`
		ThumbnailPhoto string `json:"thumbnailPhoto"`
		ID             string `json:"id"`
		Emails         []struct {
			Value string `json:"value"`
		} `json:"emails"`
		AccessGroups []string `json:"accessGroups"`
		OidcClaims   struct {
			Exp               int      `json:"exp"`
			Iat               int      `json:"iat"`
			AuthTime          int      `json:"auth_time"`
			Jti               string   `json:"jti"`
			Iss               string   `json:"iss"`
			Aud               string   `json:"aud"`
			Sub               string   `json:"sub"`
			Typ               string   `json:"typ"`
			Azp               string   `json:"azp"`
			Sid               string   `json:"sid"`
			AtHash            string   `json:"at_hash"`
			Acr               string   `json:"acr"`
			EmailVerified     bool     `json:"email_verified"`
			AccessGroups      []string `json:"accessGroups"`
			Name              string   `json:"name"`
			PreferredUsername string   `json:"preferred_username"`
			GivenName         string   `json:"given_name"`
			FamilyName        string   `json:"family_name"`
			Email             string   `json:"email"`
		} `json:"oidcClaims"`
		ID_ string `json:"_id"`
	} `json:"profile"`
	Provider    string    `json:"provider"`
	UserID      string    `json:"userId"`
	Created     time.Time `json:"created"`
	Modified    time.Time `json:"modified"`
	V           int       `json:"__v"`
	ScicatToken string
}

Jump to

Keyboard shortcuts

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