client

package
v0.0.0-...-e8da0a6 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_HEADER_X_OLD_CLIENT_TOKEN = "x-sudory-client-token"
)

Variables

View Source
var ErrorInvalidIncomingContext = fmt.Errorf("invalid incoming context")
View Source
var ErrorInvalidToken = fmt.Errorf("invalid token")

Functions

func GetClientSessionClaims

func GetClientSessionClaims(ctx context.Context, header http.Header) (string, *model.ClusterClientSessionClaim, error)
func Header(md metadata.MD) http.Header

func KeepAliveClientSessionStatus

func KeepAliveClientSessionStatus(ctx context.Context, claimsToken string, claims model.ClusterClientSessionClaim, keepAliveTimeout time.Duration, errorHandler ...func(err error))

func NewNullString

func NewNullString(s string) sql.NullString

func NewNullTime

func NewNullTime(t *timestamppb.Timestamp) sql.NullTime

func PollServiceFilter

func PollServiceFilter(limit int, exp time.Time, now time.Time) func(*model.ClusterService) bool

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	TokenType    string `json:"token_type"   enum:"Basic,Bearer"` // (required)
	AccessToken  string `json:"access_token"`                     // (required)
	ExpiresIn    int64  `json:"expires_in,omitempty"`             // (recommended)
	RefreshToken string `json:"refresh_token,omitempty"`          // (optional)
	Scope        string `json:"scope,omitempty"`                  // (optional)
}

type Auth

type Auth struct {
	ClusterUuid      string `json:"cluster_uuid"`
	Assertion        string `json:"assertion"`
	ClientVersion    string `json:"client_version"`
	ClientLibVersion string `json:"client_lib_version"`
}

type Echo

type Echo struct{}

func (Echo) Auth

func (Echo) Auth(ctx echo.Context) error

@Description auth client @Accept json @Produce json @Tags /api/v1/client @Router /api/v1/client/auth [post] @Param body body Auth true "Auth" @Success 200 {string} ok @Header 200 {string} x-sudory-client-token @Header 200 {object} AccessTokenResponse

func (Echo) PollService

func (Echo) PollService(ctx echo.Context) error

@Description get []Service @Security ClientAuthorization @Accept json @Produce json @Tags /api/v1/client @Router /api/v1/client/service [get] @param limit query int false "count limit of ServiceResponse"" @Success 200 {array} ServiceResponse

func (Echo) UpdateService

func (Echo) UpdateService(ctx echo.Context) error

@Description update a service status @Security ClientAuthorization @Accept json @Produce json @Tags /api/v1/client @Router /api/v1/client/service [put] @Param body body ServiceStatus true "ServiceStatus" @Success 200

type GRPC

func (*GRPC) AuthV1

AuthV1 implements client.ClientServiceServer

func (*GRPC) ServicePollingV1

ServicePollingV1 implements client.ClientServiceServer

func (*GRPC) UpdateServiceStatusV1

func (*GRPC) UpdateServiceStatusV1(ctx context.Context, serviceStatus *client.UpdateServiceStatusRequestV1) (*client.UpdateServiceStatusResponseV1, error)

UpdateServiceStatusV1 implements client.ClientServiceServer

type Map

type Map = map[string]any

func EmbedFields

func EmbedFields(m Map, mm ...Map) Map

type Object

type Object = map[string]any

type ServiceResponse

type ServiceResponse struct {
	ClusterUUID       string         `json:"cluster_uuid"`
	UUID              string         `json:"uuid"`
	Name              string         `json:"name"`
	Summary           *string        `json:"summary,omitempty"`
	TemplateUUID      string         `json:"template_uuid"`
	Flow              string         `json:"flow"`
	Inputs            Object         `json:"inputs" swaggertype:"object"`
	StepMax           int            `json:"step_max"`
	SubscribedChannel *string        `json:"subscribed_channel,omitempty"`
	Priority          model.Priority `json:"priority"`
	Created           time.Time      `json:"created"`
}

func NewServiceResponse

func NewServiceResponse(service model.ClusterService) ServiceResponse

type ServiceStatus

type ServiceStatus struct {
	Uuid     string           `json:"uuid"`
	Sequence int              `json:"sequence"`
	Status   model.StepStatus `json:"status"`
	Error    *string          `json:"error,omitempty"`
	Started  *time.Time       `json:"started,omitempty"`
	Ended    *time.Time       `json:"ended,omitempty"`
	Result   *string          `json:"result,omitempty"`
}

Jump to

Keyboard shortcuts

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