Add SPA UI for GARM
This change adds a single page application front-end to GARM. It uses a generated REST client, built from the swagger definitions, the websocket interface for live updates of entities and eager loading of everything except runners, as users may have many runners and we don't want to load hundreds of runners in memory. Proper pagination should be implemented in the API, in future commits, to avoid loading lots of elements for no reason. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
a811d129d0
commit
eec158b32c
230 changed files with 47324 additions and 2045 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -23,3 +23,5 @@ node_modules/
|
||||||
.svelte-kit/
|
.svelte-kit/
|
||||||
debug.html
|
debug.html
|
||||||
git_push.sh
|
git_push.sh
|
||||||
|
webapp/src/lib/api/generated/docs
|
||||||
|
.env
|
||||||
|
|
|
||||||
27
.mockery.yaml
Normal file
27
.mockery.yaml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
with-expecter: true
|
||||||
|
dir: "mocks"
|
||||||
|
mockname: "{{ .InterfaceName }}"
|
||||||
|
outpkg: "mocks"
|
||||||
|
filename: "{{ .InterfaceName }}.go"
|
||||||
|
# V3 compatibility settings
|
||||||
|
resolve-type-alias: false
|
||||||
|
disable-version-string: true
|
||||||
|
issue-845-fix: true
|
||||||
|
packages:
|
||||||
|
# Database store interfaces
|
||||||
|
github.com/cloudbase/garm/database/common:
|
||||||
|
interfaces:
|
||||||
|
Store:
|
||||||
|
config:
|
||||||
|
dir: "{{ .InterfaceDir }}/mocks"
|
||||||
|
# Runner interfaces
|
||||||
|
github.com/cloudbase/garm/runner:
|
||||||
|
interfaces:
|
||||||
|
PoolManagerController:
|
||||||
|
config:
|
||||||
|
dir: "{{ .InterfaceDir }}/mocks"
|
||||||
|
# Runner common interfaces (generate all interfaces in this package)
|
||||||
|
github.com/cloudbase/garm/runner/common:
|
||||||
|
config:
|
||||||
|
dir: "{{ .InterfaceDir }}/mocks"
|
||||||
|
all: true
|
||||||
16
Makefile
16
Makefile
|
|
@ -6,6 +6,7 @@ export SHELLOPTS:=$(if $(SHELLOPTS),$(SHELLOPTS):)pipefail:errexit
|
||||||
GEN_PASSWORD=$(shell (/usr/bin/apg -n1 -m32))
|
GEN_PASSWORD=$(shell (/usr/bin/apg -n1 -m32))
|
||||||
IMAGE_TAG = garm-build
|
IMAGE_TAG = garm-build
|
||||||
|
|
||||||
|
HAS_TAILWINDCSS=$(shell (which tailwindcss || echo "no"))
|
||||||
IMAGE_BUILDER=$(shell (which docker || which podman))
|
IMAGE_BUILDER=$(shell (which docker || which podman))
|
||||||
IS_PODMAN=$(shell (($(IMAGE_BUILDER) --version | grep -q podman) && echo "yes" || echo "no"))
|
IS_PODMAN=$(shell (($(IMAGE_BUILDER) --version | grep -q podman) && echo "yes" || echo "no"))
|
||||||
USER_ID=$(if $(filter yes,$(IS_PODMAN)),0,$(shell id -u))
|
USER_ID=$(if $(filter yes,$(IS_PODMAN)),0,$(shell id -u))
|
||||||
|
|
@ -55,6 +56,21 @@ build: ## Build garm
|
||||||
@$(GO) build -ldflags "-s -w -X github.com/cloudbase/garm/util/appdefaults.Version=${VERSION}" -tags osusergo,netgo,sqlite_omit_load_extension -o bin/garm-cli ./cmd/garm-cli
|
@$(GO) build -ldflags "-s -w -X github.com/cloudbase/garm/util/appdefaults.Version=${VERSION}" -tags osusergo,netgo,sqlite_omit_load_extension -o bin/garm-cli ./cmd/garm-cli
|
||||||
@echo Binaries are available in $(PWD)/bin
|
@echo Binaries are available in $(PWD)/bin
|
||||||
|
|
||||||
|
.PHONY: build-webui
|
||||||
|
build-webui:
|
||||||
|
@echo Building GARM web ui
|
||||||
|
./build-webapp.sh
|
||||||
|
rm -rf webapp/assets/_app
|
||||||
|
cp -r webapp/build/* webapp/assets/
|
||||||
|
|
||||||
|
.PHONY: generate
|
||||||
|
generate: ## Run go generate after checking required tools are in PATH
|
||||||
|
@echo Checking required tools...
|
||||||
|
@which openapi-generator-cli > /dev/null || (echo "Error: openapi-generator-cli not found in PATH" && exit 1)
|
||||||
|
@which tailwindcss > /dev/null || (echo "Error: tailwindcss not found in PATH" && exit 1)
|
||||||
|
@echo Running go generate
|
||||||
|
@$(GO) generate ./...
|
||||||
|
|
||||||
test: verify go-test ## Run tests
|
test: verify go-test ## Run tests
|
||||||
|
|
||||||
##@ Release
|
##@ Release
|
||||||
|
|
|
||||||
12
README.md
12
README.md
|
|
@ -18,6 +18,7 @@
|
||||||
- [Installing on Kubernetes](#installing-on-kubernetes)
|
- [Installing on Kubernetes](#installing-on-kubernetes)
|
||||||
- [Configuring GARM for GHES](#configuring-garm-for-ghes)
|
- [Configuring GARM for GHES](#configuring-garm-for-ghes)
|
||||||
- [Configuring GARM for Gitea](#configuring-garm-for-gitea)
|
- [Configuring GARM for Gitea](#configuring-garm-for-gitea)
|
||||||
|
- [Enabling the web UI](#enabling-the-web-ui)
|
||||||
- [Using GARM](#using-garm)
|
- [Using GARM](#using-garm)
|
||||||
- [Supported providers](#supported-providers)
|
- [Supported providers](#supported-providers)
|
||||||
- [Installing external providers](#installing-external-providers)
|
- [Installing external providers](#installing-external-providers)
|
||||||
|
|
@ -78,6 +79,17 @@ GARM supports creating pools and scale sets in either GitHub itself or in your o
|
||||||
|
|
||||||
GARM now has support for Gitea (>=1.24.0). For information on getting started with Gitea, see the [Gitea quickstart](/doc/gitea.md) document.
|
GARM now has support for Gitea (>=1.24.0). For information on getting started with Gitea, see the [Gitea quickstart](/doc/gitea.md) document.
|
||||||
|
|
||||||
|
## Enabling the web UI
|
||||||
|
|
||||||
|
GARM now ships with a single page application. To enable it, add the following to your GARM config:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[apiserver.webui]
|
||||||
|
enable = true
|
||||||
|
```
|
||||||
|
|
||||||
|
Check the [README.md](/webapp/README.md) file for details on the web UI.
|
||||||
|
|
||||||
## Using GARM
|
## Using GARM
|
||||||
|
|
||||||
GARM is designed with simplicity in mind. At least we try to keep it as simple as possible. We're aware that adding a new tool in your workflow can be painful, especially when you already have to deal with so many. The cognitive load for OPS has reached a level where it feels overwhelming at times to even wrap your head around a new tool. As such, we believe that tools should be simple, should take no more than a few hours to understand and set up and if you absolutely need to interact with the tool, it should be as intuitive as possible. Although we try our best to make this happen, we're aware that GARM has some rough edges, especially for new users. If you encounter issues or feel like the setup process was too complicated, please let us know. We're always looking to improve the user experience.
|
GARM is designed with simplicity in mind. At least we try to keep it as simple as possible. We're aware that adding a new tool in your workflow can be painful, especially when you already have to deal with so many. The cognitive load for OPS has reached a level where it feels overwhelming at times to even wrap your head around a new tool. As such, we believe that tools should be simple, should take no more than a few hours to understand and set up and if you absolutely need to interact with the tool, it should be as intuitive as possible. Although we try our best to make this happen, we're aware that GARM has some rough edges, especially for new users. If you encounter issues or feel like the setup process was too complicated, please let us know. We're always looking to improve the user experience.
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
|
@ -31,17 +32,42 @@ import (
|
||||||
"github.com/cloudbase/garm/apiserver/events"
|
"github.com/cloudbase/garm/apiserver/events"
|
||||||
"github.com/cloudbase/garm/apiserver/params"
|
"github.com/cloudbase/garm/apiserver/params"
|
||||||
"github.com/cloudbase/garm/auth"
|
"github.com/cloudbase/garm/auth"
|
||||||
|
"github.com/cloudbase/garm/config"
|
||||||
"github.com/cloudbase/garm/metrics"
|
"github.com/cloudbase/garm/metrics"
|
||||||
runnerParams "github.com/cloudbase/garm/params"
|
runnerParams "github.com/cloudbase/garm/params"
|
||||||
"github.com/cloudbase/garm/runner" //nolint:typecheck
|
"github.com/cloudbase/garm/runner" //nolint:typecheck
|
||||||
|
garmUtil "github.com/cloudbase/garm/util"
|
||||||
wsWriter "github.com/cloudbase/garm/websocket"
|
wsWriter "github.com/cloudbase/garm/websocket"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewAPIController(r *runner.Runner, authenticator *auth.Authenticator, hub *wsWriter.Hub) (*APIController, error) {
|
func NewAPIController(r *runner.Runner, authenticator *auth.Authenticator, hub *wsWriter.Hub, apiCfg config.APIServer) (*APIController, error) {
|
||||||
controllerInfo, err := r.GetControllerInfo(auth.GetAdminContext(context.Background()))
|
controllerInfo, err := r.GetControllerInfo(auth.GetAdminContext(context.Background()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to get controller info")
|
return nil, errors.Wrap(err, "failed to get controller info")
|
||||||
}
|
}
|
||||||
|
var checkOrigin func(r *http.Request) bool
|
||||||
|
if len(apiCfg.CORSOrigins) > 0 {
|
||||||
|
checkOrigin = func(r *http.Request) bool {
|
||||||
|
origin := r.Header["Origin"]
|
||||||
|
if len(origin) == 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
u, err := url.Parse(origin[0])
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, val := range apiCfg.CORSOrigins {
|
||||||
|
corsVal, err := url.Parse(val)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if garmUtil.ASCIIEqualFold(u.Host, corsVal.Host) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
return &APIController{
|
return &APIController{
|
||||||
r: r,
|
r: r,
|
||||||
auth: authenticator,
|
auth: authenticator,
|
||||||
|
|
@ -49,6 +75,7 @@ func NewAPIController(r *runner.Runner, authenticator *auth.Authenticator, hub *
|
||||||
upgrader: websocket.Upgrader{
|
upgrader: websocket.Upgrader{
|
||||||
ReadBufferSize: 1024,
|
ReadBufferSize: 1024,
|
||||||
WriteBufferSize: 16384,
|
WriteBufferSize: 16384,
|
||||||
|
CheckOrigin: checkOrigin,
|
||||||
},
|
},
|
||||||
controllerID: controllerInfo.ControllerID.String(),
|
controllerID: controllerInfo.ControllerID.String(),
|
||||||
}, nil
|
}, nil
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ import (
|
||||||
|
|
||||||
"github.com/cloudbase/garm/apiserver/controllers"
|
"github.com/cloudbase/garm/apiserver/controllers"
|
||||||
"github.com/cloudbase/garm/auth"
|
"github.com/cloudbase/garm/auth"
|
||||||
|
"github.com/cloudbase/garm/config"
|
||||||
|
spaAssets "github.com/cloudbase/garm/webapp/assets"
|
||||||
)
|
)
|
||||||
|
|
||||||
func WithMetricsRouter(parentRouter *mux.Router, disableAuth bool, metricsMiddlerware auth.Middleware) *mux.Router {
|
func WithMetricsRouter(parentRouter *mux.Router, disableAuth bool, metricsMiddlerware auth.Middleware) *mux.Router {
|
||||||
|
|
@ -82,6 +84,30 @@ func WithDebugServer(parentRouter *mux.Router) *mux.Router {
|
||||||
return parentRouter
|
return parentRouter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithWebUI(parentRouter *mux.Router, apiConfig config.APIServer) *mux.Router {
|
||||||
|
if parentRouter == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if apiConfig.WebUI.EnableWebUI {
|
||||||
|
slog.Info("WebUI is enabled, adding webapp routes")
|
||||||
|
webappPath := apiConfig.WebUI.GetWebappPath()
|
||||||
|
slog.Info("Using webapp path", "path", webappPath)
|
||||||
|
// Accessing / should redirect to the UI
|
||||||
|
parentRouter.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
http.Redirect(w, r, webappPath, http.StatusMovedPermanently) // 301
|
||||||
|
})
|
||||||
|
// Serve the SPA with dynamic path
|
||||||
|
parentRouter.PathPrefix(webappPath).HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
spaAssets.ServeSPAWithPath(w, r, webappPath)
|
||||||
|
}).Methods("GET")
|
||||||
|
} else {
|
||||||
|
slog.Info("WebUI is disabled, skipping webapp routes")
|
||||||
|
}
|
||||||
|
|
||||||
|
return parentRouter
|
||||||
|
}
|
||||||
|
|
||||||
func requestLogger(h http.Handler) http.Handler {
|
func requestLogger(h http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
// gathers metrics from the upstream handlers
|
// gathers metrics from the upstream handlers
|
||||||
|
|
@ -505,7 +531,7 @@ func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware
|
||||||
apiRouter.Handle("/ws/events/", http.HandlerFunc(han.EventsHandler)).Methods("GET")
|
apiRouter.Handle("/ws/events/", http.HandlerFunc(han.EventsHandler)).Methods("GET")
|
||||||
apiRouter.Handle("/ws/events", http.HandlerFunc(han.EventsHandler)).Methods("GET")
|
apiRouter.Handle("/ws/events", http.HandlerFunc(han.EventsHandler)).Methods("GET")
|
||||||
|
|
||||||
// NotFound handler
|
// NotFound handler - this should be last
|
||||||
apiRouter.PathPrefix("/").HandlerFunc(han.NotFoundHandler).Methods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
apiRouter.PathPrefix("/").HandlerFunc(han.NotFoundHandler).Methods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ type initRequired struct {
|
||||||
func (i *initRequired) Middleware(next http.Handler) http.Handler {
|
func (i *initRequired) Middleware(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
ctrlInfo, err := i.store.ControllerInfo()
|
|
||||||
if err != nil || ctrlInfo.ControllerID.String() == "" {
|
if !i.store.HasAdminUser(ctx) {
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
w.WriteHeader(http.StatusConflict)
|
w.WriteHeader(http.StatusConflict)
|
||||||
if err := json.NewEncoder(w).Encode(params.InitializationRequired); err != nil {
|
if err := json.NewEncoder(w).Encode(params.InitializationRequired); err != nil {
|
||||||
|
|
|
||||||
16
build-webapp.sh
Executable file
16
build-webapp.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Building GARM SPA (SvelteKit)..."
|
||||||
|
|
||||||
|
# Navigate to webapp directory
|
||||||
|
cd webapp
|
||||||
|
|
||||||
|
# Install dependencies if node_modules doesn't exist
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Build the SPA
|
||||||
|
echo "Building SPA..."
|
||||||
|
npm run build
|
||||||
|
echo "SPA built successfully!"
|
||||||
|
|
@ -283,7 +283,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
authenticator := auth.NewAuthenticator(cfg.JWTAuth, db)
|
authenticator := auth.NewAuthenticator(cfg.JWTAuth, db)
|
||||||
controller, err := controllers.NewAPIController(runner, authenticator, hub)
|
controller, err := controllers.NewAPIController(runner, authenticator, hub, cfg.APIServer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to create controller: %+v", err)
|
log.Fatalf("failed to create controller: %+v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -315,6 +315,9 @@ func main() {
|
||||||
|
|
||||||
router := routers.NewAPIRouter(controller, jwtMiddleware, initMiddleware, urlsRequiredMiddleware, instanceMiddleware, cfg.Default.EnableWebhookManagement)
|
router := routers.NewAPIRouter(controller, jwtMiddleware, initMiddleware, urlsRequiredMiddleware, instanceMiddleware, cfg.Default.EnableWebhookManagement)
|
||||||
|
|
||||||
|
// Add WebUI routes
|
||||||
|
router = routers.WithWebUI(router, cfg.APIServer)
|
||||||
|
|
||||||
// start the metrics collector
|
// start the metrics collector
|
||||||
if cfg.Metrics.Enable {
|
if cfg.Metrics.Enable {
|
||||||
slog.InfoContext(ctx, "setting up metric routes")
|
slog.InfoContext(ctx, "setting up metric routes")
|
||||||
|
|
|
||||||
|
|
@ -663,6 +663,21 @@ func (m *Metrics) Duration() time.Duration {
|
||||||
return duration
|
return duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WebUI holds configuration for the web UI
|
||||||
|
type WebUI struct {
|
||||||
|
EnableWebUI bool `toml:"enable" json:"enable"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates the WebUI config
|
||||||
|
func (w *WebUI) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetWebappPath returns the webapp path with proper formatting
|
||||||
|
func (w *WebUI) GetWebappPath() string {
|
||||||
|
return "/ui/"
|
||||||
|
}
|
||||||
|
|
||||||
// APIServer holds configuration for the API server
|
// APIServer holds configuration for the API server
|
||||||
// worker
|
// worker
|
||||||
type APIServer struct {
|
type APIServer struct {
|
||||||
|
|
@ -671,6 +686,7 @@ type APIServer struct {
|
||||||
UseTLS bool `toml:"use_tls" json:"use-tls"`
|
UseTLS bool `toml:"use_tls" json:"use-tls"`
|
||||||
TLSConfig TLSConfig `toml:"tls" json:"tls"`
|
TLSConfig TLSConfig `toml:"tls" json:"tls"`
|
||||||
CORSOrigins []string `toml:"cors_origins" json:"cors-origins"`
|
CORSOrigins []string `toml:"cors_origins" json:"cors-origins"`
|
||||||
|
WebUI WebUI `toml:"webui" json:"webui"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindAddress returns a host:port string.
|
// BindAddress returns a host:port string.
|
||||||
|
|
@ -696,6 +712,11 @@ func (a *APIServer) Validate() error {
|
||||||
// when we try to bind to it.
|
// when we try to bind to it.
|
||||||
return fmt.Errorf("invalid IP address")
|
return fmt.Errorf("invalid IP address")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := a.WebUI.Validate(); err != nil {
|
||||||
|
return fmt.Errorf("invalid webui config: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -169,7 +169,7 @@ type GiteaCredentialsStore interface {
|
||||||
DeleteGiteaCredentials(ctx context.Context, id uint) (err error)
|
DeleteGiteaCredentials(ctx context.Context, id uint) (err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:generate mockery --name=Store
|
//go:generate go run github.com/vektra/mockery/v2@latest
|
||||||
type Store interface {
|
type Store interface {
|
||||||
RepoStore
|
RepoStore
|
||||||
OrgStore
|
OrgStore
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ const (
|
||||||
func (s *sqlDatabase) ListAllPools(_ context.Context) ([]params.Pool, error) {
|
func (s *sqlDatabase) ListAllPools(_ context.Context) ([]params.Pool, error) {
|
||||||
var pools []Pool
|
var pools []Pool
|
||||||
|
|
||||||
q := s.conn.Model(&Pool{}).
|
q := s.conn.
|
||||||
Preload("Tags").
|
Preload("Tags").
|
||||||
Preload("Organization").
|
Preload("Organization").
|
||||||
Preload("Organization.Endpoint").
|
Preload("Organization.Endpoint").
|
||||||
|
|
@ -46,7 +46,6 @@ func (s *sqlDatabase) ListAllPools(_ context.Context) ([]params.Pool, error) {
|
||||||
Preload("Enterprise").
|
Preload("Enterprise").
|
||||||
Preload("Enterprise.Endpoint").
|
Preload("Enterprise.Endpoint").
|
||||||
Omit("extra_specs").
|
Omit("extra_specs").
|
||||||
Omit("status_messages").
|
|
||||||
Find(&pools)
|
Find(&pools)
|
||||||
if q.Error != nil {
|
if q.Error != nil {
|
||||||
return nil, errors.Wrap(q.Error, "fetching all pools")
|
return nil, errors.Wrap(q.Error, "fetching all pools")
|
||||||
|
|
@ -393,7 +392,7 @@ func (s *sqlDatabase) DeleteEntityPool(_ context.Context, entity params.ForgeEnt
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sqlDatabase) UpdateEntityPool(_ context.Context, entity params.ForgeEntity, poolID string, param params.UpdatePoolParams) (updatedPool params.Pool, err error) {
|
func (s *sqlDatabase) UpdateEntityPool(ctx context.Context, entity params.ForgeEntity, poolID string, param params.UpdatePoolParams) (updatedPool params.Pool, err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s.sendNotify(common.PoolEntityType, common.UpdateOperation, updatedPool)
|
s.sendNotify(common.PoolEntityType, common.UpdateOperation, updatedPool)
|
||||||
|
|
@ -414,6 +413,11 @@ func (s *sqlDatabase) UpdateEntityPool(_ context.Context, entity params.ForgeEnt
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return params.Pool{}, err
|
return params.Pool{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatedPool, err = s.GetPoolByID(ctx, poolID)
|
||||||
|
if err != nil {
|
||||||
|
return params.Pool{}, err
|
||||||
|
}
|
||||||
return updatedPool, nil
|
return updatedPool, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ func (s *sqlDatabase) ListEntityScaleSets(_ context.Context, entity params.Forge
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sqlDatabase) UpdateEntityScaleSet(_ context.Context, entity params.ForgeEntity, scaleSetID uint, param params.UpdateScaleSetParams, callback func(old, newSet params.ScaleSet) error) (updatedScaleSet params.ScaleSet, err error) {
|
func (s *sqlDatabase) UpdateEntityScaleSet(ctx context.Context, entity params.ForgeEntity, scaleSetID uint, param params.UpdateScaleSetParams, callback func(old, newSet params.ScaleSet) error) (updatedScaleSet params.ScaleSet, err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s.sendNotify(common.ScaleSetEntityType, common.UpdateOperation, updatedScaleSet)
|
s.sendNotify(common.ScaleSetEntityType, common.UpdateOperation, updatedScaleSet)
|
||||||
|
|
@ -225,6 +225,11 @@ func (s *sqlDatabase) UpdateEntityScaleSet(_ context.Context, entity params.Forg
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return params.ScaleSet{}, err
|
return params.ScaleSet{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatedScaleSet, err = s.GetScaleSetByID(ctx, scaleSetID)
|
||||||
|
if err != nil {
|
||||||
|
return params.ScaleSet{}, err
|
||||||
|
}
|
||||||
return updatedScaleSet, nil
|
return updatedScaleSet, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -345,7 +350,17 @@ func (s *sqlDatabase) updateScaleSet(tx *gorm.DB, scaleSet ScaleSet, param param
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sqlDatabase) GetScaleSetByID(_ context.Context, scaleSet uint) (params.ScaleSet, error) {
|
func (s *sqlDatabase) GetScaleSetByID(_ context.Context, scaleSet uint) (params.ScaleSet, error) {
|
||||||
set, err := s.getScaleSetByID(s.conn, scaleSet, "Instances", "Enterprise", "Organization", "Repository")
|
set, err := s.getScaleSetByID(
|
||||||
|
s.conn,
|
||||||
|
scaleSet,
|
||||||
|
"Instances",
|
||||||
|
"Enterprise",
|
||||||
|
"Enterprise.Endpoint",
|
||||||
|
"Organization",
|
||||||
|
"Organization.Endpoint",
|
||||||
|
"Repository",
|
||||||
|
"Repository.Endpoint",
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return params.ScaleSet{}, errors.Wrap(err, "fetching scale set by ID")
|
return params.ScaleSet{}, errors.Wrap(err, "fetching scale set by ID")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -600,6 +600,11 @@ func (s *WatcherStoreTestSuite) TestScaleSetWatcher() {
|
||||||
// We updated last message ID and desired runner count above.
|
// We updated last message ID and desired runner count above.
|
||||||
updatedScaleSet.DesiredRunnerCount = 5
|
updatedScaleSet.DesiredRunnerCount = 5
|
||||||
updatedScaleSet.LastMessageID = 99
|
updatedScaleSet.LastMessageID = 99
|
||||||
|
payloadFromEvent, ok := event.Payload.(params.ScaleSet)
|
||||||
|
s.Require().True(ok)
|
||||||
|
updatedScaleSet.UpdatedAt = payloadFromEvent.UpdatedAt
|
||||||
|
updatedScaleSet.CreatedAt = payloadFromEvent.CreatedAt
|
||||||
|
updatedScaleSet.Endpoint = params.ForgeEndpoint{}
|
||||||
s.Require().Equal(common.ChangePayload{
|
s.Require().Equal(common.ChangePayload{
|
||||||
EntityType: common.ScaleSetEntityType,
|
EntityType: common.ScaleSetEntityType,
|
||||||
Operation: common.DeleteOperation,
|
Operation: common.DeleteOperation,
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,13 @@ First, clone the repository:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/cloudbase/garm
|
git clone https://github.com/cloudbase/garm
|
||||||
|
cd garm
|
||||||
```
|
```
|
||||||
|
|
||||||
Then build garm:
|
Then build garm:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
You should now have both `garm` and `garm-cli` available in the `./bin` folder.
|
You should now have both `garm` and `garm-cli` available in the `./bin` folder.
|
||||||
|
|
@ -23,3 +24,64 @@ make build-static
|
||||||
```
|
```
|
||||||
|
|
||||||
This command will also build for both AMD64 and ARM64. Resulting binaries will be in the `./bin` folder.
|
This command will also build for both AMD64 and ARM64. Resulting binaries will be in the `./bin` folder.
|
||||||
|
|
||||||
|
## Hacking
|
||||||
|
|
||||||
|
If you're hacking on GARM and want to override the default version GARM injects, you can run the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
VERSION=v1.0.0 make build
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> This only works for `make build`. The `make build-static` command does not support version overrides.
|
||||||
|
|
||||||
|
## The Web UI SPA
|
||||||
|
|
||||||
|
GARM now ships with a single page application. The application is written in svelte and tailwind CSS. To rebuild it or hack on it, you will need a number of dependencies installed and placed in your `$PATH`.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- **Node.js 24+** and **npm**
|
||||||
|
- **Go 1.21+** (for building the GARM backend)
|
||||||
|
- **openapi-generator-cli** in your PATH (for API client generation)
|
||||||
|
|
||||||
|
### Installing openapi-generator-cli
|
||||||
|
|
||||||
|
**Option 1: NPM Global Install**
|
||||||
|
```bash
|
||||||
|
npm install -g @openapitools/openapi-generator-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
**Option 2: Manual Install**
|
||||||
|
Download from [OpenAPI Generator releases](https://github.com/OpenAPITools/openapi-generator/releases) and add to your PATH.
|
||||||
|
|
||||||
|
**Verify Installation:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
openapi-generator-cli version
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Hacking on the Web UI
|
||||||
|
|
||||||
|
If you need to change something in the `webapp/src` folder, make sure to rebuild the webapp before rebuilding GARM:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make build-webui
|
||||||
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The Web UI that GARM ships with has `go generate` stanzas that require `@openapitools/openapi-generator-cli` and `tailwindcss` to be installed. You will also have to make sure that if you change API models, the Web UI still works, as adding new fields or changing the json tags of old fields will change accessors in the client code.
|
||||||
|
|
||||||
|
### Changing API models
|
||||||
|
|
||||||
|
If you need to change the models in the `params/` package, you will also need to regenerate the client both for garm-cli and for the web application we ship with GARM. To do this, you can run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make generate
|
||||||
|
```
|
||||||
|
|
||||||
|
You will also need to make sure that the web app still works.
|
||||||
|
|
|
||||||
|
|
@ -473,6 +473,8 @@ The config options are fairly straight forward.
|
||||||
certificate = ""
|
certificate = ""
|
||||||
# The path on disk to the corresponding private key for the certificate.
|
# The path on disk to the corresponding private key for the certificate.
|
||||||
key = ""
|
key = ""
|
||||||
|
[apiserver.webui]
|
||||||
|
enable = true
|
||||||
```
|
```
|
||||||
|
|
||||||
The GARM API server has the option to enable TLS, but I suggest you use a reverse proxy and enable TLS termination in that reverse proxy. There is an `nginx` sample in this repository with TLS termination enabled.
|
The GARM API server has the option to enable TLS, but I suggest you use a reverse proxy and enable TLS termination in that reverse proxy. There is an `nginx` sample in this repository with TLS termination enabled.
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,9 @@ time_to_live = "8760h"
|
||||||
bind = "0.0.0.0"
|
bind = "0.0.0.0"
|
||||||
port = 80
|
port = 80
|
||||||
use_tls = false
|
use_tls = false
|
||||||
|
[apiserver.webui]
|
||||||
|
# Set this to false if you want to disable the Web UI.
|
||||||
|
enable = true
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
backend = "sqlite3"
|
backend = "sqlite3"
|
||||||
|
|
|
||||||
6
go.mod
6
go.mod
|
|
@ -50,7 +50,7 @@ require (
|
||||||
github.com/go-logr/logr v1.4.3 // indirect
|
github.com/go-logr/logr v1.4.3 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-openapi/analysis v0.23.0 // indirect
|
github.com/go-openapi/analysis v0.23.0 // indirect
|
||||||
github.com/go-openapi/jsonpointer v0.21.1 // indirect
|
github.com/go-openapi/jsonpointer v0.21.2 // indirect
|
||||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||||
github.com/go-openapi/loads v0.22.0 // indirect
|
github.com/go-openapi/loads v0.22.0 // indirect
|
||||||
github.com/go-openapi/spec v0.21.0 // indirect
|
github.com/go-openapi/spec v0.21.0 // indirect
|
||||||
|
|
@ -68,7 +68,7 @@ require (
|
||||||
github.com/mailru/easyjson v0.9.0 // indirect
|
github.com/mailru/easyjson v0.9.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||||
github.com/mattn/go-sqlite3 v1.14.28 // indirect
|
github.com/mattn/go-sqlite3 v1.14.31 // indirect
|
||||||
github.com/minio/sio v0.4.1 // indirect
|
github.com/minio/sio v0.4.1 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
|
|
@ -79,7 +79,7 @@ require (
|
||||||
github.com/prometheus/common v0.65.0 // indirect
|
github.com/prometheus/common v0.65.0 // indirect
|
||||||
github.com/prometheus/procfs v0.16.1 // indirect
|
github.com/prometheus/procfs v0.16.1 // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/spf13/pflag v1.0.6 // indirect
|
github.com/spf13/pflag v1.0.7 // indirect
|
||||||
github.com/stretchr/objx v0.5.2 // indirect
|
github.com/stretchr/objx v0.5.2 // indirect
|
||||||
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect
|
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect
|
||||||
go.mongodb.org/mongo-driver v1.17.4 // indirect
|
go.mongodb.org/mongo-driver v1.17.4 // indirect
|
||||||
|
|
|
||||||
11
go.sum
11
go.sum
|
|
@ -36,8 +36,8 @@ github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC0
|
||||||
github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo=
|
github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo=
|
||||||
github.com/go-openapi/errors v0.22.2 h1:rdxhzcBUazEcGccKqbY1Y7NS8FDcMyIRr0934jrYnZg=
|
github.com/go-openapi/errors v0.22.2 h1:rdxhzcBUazEcGccKqbY1Y7NS8FDcMyIRr0934jrYnZg=
|
||||||
github.com/go-openapi/errors v0.22.2/go.mod h1:+n/5UdIqdVnLIJ6Q9Se8HNGUXYaY6CN8ImWzfi/Gzp0=
|
github.com/go-openapi/errors v0.22.2/go.mod h1:+n/5UdIqdVnLIJ6Q9Se8HNGUXYaY6CN8ImWzfi/Gzp0=
|
||||||
github.com/go-openapi/jsonpointer v0.21.1 h1:whnzv/pNXtK2FbX/W9yJfRmE2gsmkfahjMKB0fZvcic=
|
github.com/go-openapi/jsonpointer v0.21.2 h1:AqQaNADVwq/VnkCmQg6ogE+M3FOsKTytwges0JdwVuA=
|
||||||
github.com/go-openapi/jsonpointer v0.21.1/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk=
|
github.com/go-openapi/jsonpointer v0.21.2/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk=
|
||||||
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
|
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
|
||||||
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
|
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
|
||||||
github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco=
|
github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco=
|
||||||
|
|
@ -127,8 +127,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
|
github.com/mattn/go-sqlite3 v1.14.31 h1:ldt6ghyPJsokUIlksH63gWZkG6qVGeEAu4zLeS4aVZM=
|
||||||
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
github.com/mattn/go-sqlite3 v1.14.31/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||||
github.com/microsoft/go-mssqldb v1.7.2 h1:CHkFJiObW7ItKTJfHo1QX7QBBD1iV+mn1eOyRP3b/PA=
|
github.com/microsoft/go-mssqldb v1.7.2 h1:CHkFJiObW7ItKTJfHo1QX7QBBD1iV+mn1eOyRP3b/PA=
|
||||||
github.com/microsoft/go-mssqldb v1.7.2/go.mod h1:kOvZKUdrhhFQmxLZqbwUV0rHkNkZpthMITIb2Ko1IoA=
|
github.com/microsoft/go-mssqldb v1.7.2/go.mod h1:kOvZKUdrhhFQmxLZqbwUV0rHkNkZpthMITIb2Ko1IoA=
|
||||||
github.com/minio/sio v0.4.1 h1:EMe3YBC1nf+sRQia65Rutxi+Z554XPV0dt8BIBA+a/0=
|
github.com/minio/sio v0.4.1 h1:EMe3YBC1nf+sRQia65Rutxi+Z554XPV0dt8BIBA+a/0=
|
||||||
|
|
@ -164,8 +164,9 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
|
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
|
||||||
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
|
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
|
||||||
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
|
||||||
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M=
|
||||||
|
github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
// Code generated by mockery. DO NOT EDIT.
|
||||||
|
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
|
|
@ -18,6 +18,14 @@ type GithubClient struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GithubClient_Expecter struct {
|
||||||
|
mock *mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_m *GithubClient) EXPECT() *GithubClient_Expecter {
|
||||||
|
return &GithubClient_Expecter{mock: &_m.Mock}
|
||||||
|
}
|
||||||
|
|
||||||
// CreateEntityHook provides a mock function with given fields: ctx, hook
|
// CreateEntityHook provides a mock function with given fields: ctx, hook
|
||||||
func (_m *GithubClient) CreateEntityHook(ctx context.Context, hook *github.Hook) (*github.Hook, error) {
|
func (_m *GithubClient) CreateEntityHook(ctx context.Context, hook *github.Hook) (*github.Hook, error) {
|
||||||
ret := _m.Called(ctx, hook)
|
ret := _m.Called(ctx, hook)
|
||||||
|
|
@ -48,6 +56,35 @@ func (_m *GithubClient) CreateEntityHook(ctx context.Context, hook *github.Hook)
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_CreateEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityHook'
|
||||||
|
type GithubClient_CreateEntityHook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateEntityHook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - hook *github.Hook
|
||||||
|
func (_e *GithubClient_Expecter) CreateEntityHook(ctx interface{}, hook interface{}) *GithubClient_CreateEntityHook_Call {
|
||||||
|
return &GithubClient_CreateEntityHook_Call{Call: _e.mock.On("CreateEntityHook", ctx, hook)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_CreateEntityHook_Call) Run(run func(ctx context.Context, hook *github.Hook)) *GithubClient_CreateEntityHook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*github.Hook))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_CreateEntityHook_Call) Return(ret *github.Hook, err error) *GithubClient_CreateEntityHook_Call {
|
||||||
|
_c.Call.Return(ret, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_CreateEntityHook_Call) RunAndReturn(run func(context.Context, *github.Hook) (*github.Hook, error)) *GithubClient_CreateEntityHook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// CreateEntityRegistrationToken provides a mock function with given fields: ctx
|
// CreateEntityRegistrationToken provides a mock function with given fields: ctx
|
||||||
func (_m *GithubClient) CreateEntityRegistrationToken(ctx context.Context) (*github.RegistrationToken, *github.Response, error) {
|
func (_m *GithubClient) CreateEntityRegistrationToken(ctx context.Context) (*github.RegistrationToken, *github.Response, error) {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
|
|
@ -87,6 +124,34 @@ func (_m *GithubClient) CreateEntityRegistrationToken(ctx context.Context) (*git
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_CreateEntityRegistrationToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityRegistrationToken'
|
||||||
|
type GithubClient_CreateEntityRegistrationToken_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateEntityRegistrationToken is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *GithubClient_Expecter) CreateEntityRegistrationToken(ctx interface{}) *GithubClient_CreateEntityRegistrationToken_Call {
|
||||||
|
return &GithubClient_CreateEntityRegistrationToken_Call{Call: _e.mock.On("CreateEntityRegistrationToken", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_CreateEntityRegistrationToken_Call) Run(run func(ctx context.Context)) *GithubClient_CreateEntityRegistrationToken_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_CreateEntityRegistrationToken_Call) Return(_a0 *github.RegistrationToken, _a1 *github.Response, _a2 error) *GithubClient_CreateEntityRegistrationToken_Call {
|
||||||
|
_c.Call.Return(_a0, _a1, _a2)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_CreateEntityRegistrationToken_Call) RunAndReturn(run func(context.Context) (*github.RegistrationToken, *github.Response, error)) *GithubClient_CreateEntityRegistrationToken_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// DeleteEntityHook provides a mock function with given fields: ctx, id
|
// DeleteEntityHook provides a mock function with given fields: ctx, id
|
||||||
func (_m *GithubClient) DeleteEntityHook(ctx context.Context, id int64) (*github.Response, error) {
|
func (_m *GithubClient) DeleteEntityHook(ctx context.Context, id int64) (*github.Response, error) {
|
||||||
ret := _m.Called(ctx, id)
|
ret := _m.Called(ctx, id)
|
||||||
|
|
@ -117,6 +182,35 @@ func (_m *GithubClient) DeleteEntityHook(ctx context.Context, id int64) (*github
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_DeleteEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEntityHook'
|
||||||
|
type GithubClient_DeleteEntityHook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteEntityHook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - id int64
|
||||||
|
func (_e *GithubClient_Expecter) DeleteEntityHook(ctx interface{}, id interface{}) *GithubClient_DeleteEntityHook_Call {
|
||||||
|
return &GithubClient_DeleteEntityHook_Call{Call: _e.mock.On("DeleteEntityHook", ctx, id)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_DeleteEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubClient_DeleteEntityHook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_DeleteEntityHook_Call) Return(ret *github.Response, err error) *GithubClient_DeleteEntityHook_Call {
|
||||||
|
_c.Call.Return(ret, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_DeleteEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Response, error)) *GithubClient_DeleteEntityHook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetEntity provides a mock function with no fields
|
// GetEntity provides a mock function with no fields
|
||||||
func (_m *GithubClient) GetEntity() params.ForgeEntity {
|
func (_m *GithubClient) GetEntity() params.ForgeEntity {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -135,6 +229,33 @@ func (_m *GithubClient) GetEntity() params.ForgeEntity {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_GetEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntity'
|
||||||
|
type GithubClient_GetEntity_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEntity is a helper method to define mock.On call
|
||||||
|
func (_e *GithubClient_Expecter) GetEntity() *GithubClient_GetEntity_Call {
|
||||||
|
return &GithubClient_GetEntity_Call{Call: _e.mock.On("GetEntity")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetEntity_Call) Run(run func()) *GithubClient_GetEntity_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetEntity_Call) Return(_a0 params.ForgeEntity) *GithubClient_GetEntity_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetEntity_Call) RunAndReturn(run func() params.ForgeEntity) *GithubClient_GetEntity_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetEntityHook provides a mock function with given fields: ctx, id
|
// GetEntityHook provides a mock function with given fields: ctx, id
|
||||||
func (_m *GithubClient) GetEntityHook(ctx context.Context, id int64) (*github.Hook, error) {
|
func (_m *GithubClient) GetEntityHook(ctx context.Context, id int64) (*github.Hook, error) {
|
||||||
ret := _m.Called(ctx, id)
|
ret := _m.Called(ctx, id)
|
||||||
|
|
@ -165,6 +286,35 @@ func (_m *GithubClient) GetEntityHook(ctx context.Context, id int64) (*github.Ho
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_GetEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntityHook'
|
||||||
|
type GithubClient_GetEntityHook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEntityHook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - id int64
|
||||||
|
func (_e *GithubClient_Expecter) GetEntityHook(ctx interface{}, id interface{}) *GithubClient_GetEntityHook_Call {
|
||||||
|
return &GithubClient_GetEntityHook_Call{Call: _e.mock.On("GetEntityHook", ctx, id)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubClient_GetEntityHook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetEntityHook_Call) Return(ret *github.Hook, err error) *GithubClient_GetEntityHook_Call {
|
||||||
|
_c.Call.Return(ret, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Hook, error)) *GithubClient_GetEntityHook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetEntityJITConfig provides a mock function with given fields: ctx, instance, pool, labels
|
// GetEntityJITConfig provides a mock function with given fields: ctx, instance, pool, labels
|
||||||
func (_m *GithubClient) GetEntityJITConfig(ctx context.Context, instance string, pool params.Pool, labels []string) (map[string]string, *github.Runner, error) {
|
func (_m *GithubClient) GetEntityJITConfig(ctx context.Context, instance string, pool params.Pool, labels []string) (map[string]string, *github.Runner, error) {
|
||||||
ret := _m.Called(ctx, instance, pool, labels)
|
ret := _m.Called(ctx, instance, pool, labels)
|
||||||
|
|
@ -204,6 +354,37 @@ func (_m *GithubClient) GetEntityJITConfig(ctx context.Context, instance string,
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_GetEntityJITConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntityJITConfig'
|
||||||
|
type GithubClient_GetEntityJITConfig_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEntityJITConfig is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - instance string
|
||||||
|
// - pool params.Pool
|
||||||
|
// - labels []string
|
||||||
|
func (_e *GithubClient_Expecter) GetEntityJITConfig(ctx interface{}, instance interface{}, pool interface{}, labels interface{}) *GithubClient_GetEntityJITConfig_Call {
|
||||||
|
return &GithubClient_GetEntityJITConfig_Call{Call: _e.mock.On("GetEntityJITConfig", ctx, instance, pool, labels)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetEntityJITConfig_Call) Run(run func(ctx context.Context, instance string, pool params.Pool, labels []string)) *GithubClient_GetEntityJITConfig_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(string), args[2].(params.Pool), args[3].([]string))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetEntityJITConfig_Call) Return(jitConfigMap map[string]string, runner *github.Runner, err error) *GithubClient_GetEntityJITConfig_Call {
|
||||||
|
_c.Call.Return(jitConfigMap, runner, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetEntityJITConfig_Call) RunAndReturn(run func(context.Context, string, params.Pool, []string) (map[string]string, *github.Runner, error)) *GithubClient_GetEntityJITConfig_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetWorkflowJobByID provides a mock function with given fields: ctx, owner, repo, jobID
|
// GetWorkflowJobByID provides a mock function with given fields: ctx, owner, repo, jobID
|
||||||
func (_m *GithubClient) GetWorkflowJobByID(ctx context.Context, owner string, repo string, jobID int64) (*github.WorkflowJob, *github.Response, error) {
|
func (_m *GithubClient) GetWorkflowJobByID(ctx context.Context, owner string, repo string, jobID int64) (*github.WorkflowJob, *github.Response, error) {
|
||||||
ret := _m.Called(ctx, owner, repo, jobID)
|
ret := _m.Called(ctx, owner, repo, jobID)
|
||||||
|
|
@ -243,6 +424,37 @@ func (_m *GithubClient) GetWorkflowJobByID(ctx context.Context, owner string, re
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_GetWorkflowJobByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkflowJobByID'
|
||||||
|
type GithubClient_GetWorkflowJobByID_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetWorkflowJobByID is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - owner string
|
||||||
|
// - repo string
|
||||||
|
// - jobID int64
|
||||||
|
func (_e *GithubClient_Expecter) GetWorkflowJobByID(ctx interface{}, owner interface{}, repo interface{}, jobID interface{}) *GithubClient_GetWorkflowJobByID_Call {
|
||||||
|
return &GithubClient_GetWorkflowJobByID_Call{Call: _e.mock.On("GetWorkflowJobByID", ctx, owner, repo, jobID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetWorkflowJobByID_Call) Run(run func(ctx context.Context, owner string, repo string, jobID int64)) *GithubClient_GetWorkflowJobByID_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetWorkflowJobByID_Call) Return(_a0 *github.WorkflowJob, _a1 *github.Response, _a2 error) *GithubClient_GetWorkflowJobByID_Call {
|
||||||
|
_c.Call.Return(_a0, _a1, _a2)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GetWorkflowJobByID_Call) RunAndReturn(run func(context.Context, string, string, int64) (*github.WorkflowJob, *github.Response, error)) *GithubClient_GetWorkflowJobByID_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GithubBaseURL provides a mock function with no fields
|
// GithubBaseURL provides a mock function with no fields
|
||||||
func (_m *GithubClient) GithubBaseURL() *url.URL {
|
func (_m *GithubClient) GithubBaseURL() *url.URL {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -263,6 +475,33 @@ func (_m *GithubClient) GithubBaseURL() *url.URL {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_GithubBaseURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GithubBaseURL'
|
||||||
|
type GithubClient_GithubBaseURL_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GithubBaseURL is a helper method to define mock.On call
|
||||||
|
func (_e *GithubClient_Expecter) GithubBaseURL() *GithubClient_GithubBaseURL_Call {
|
||||||
|
return &GithubClient_GithubBaseURL_Call{Call: _e.mock.On("GithubBaseURL")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GithubBaseURL_Call) Run(run func()) *GithubClient_GithubBaseURL_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GithubBaseURL_Call) Return(_a0 *url.URL) *GithubClient_GithubBaseURL_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_GithubBaseURL_Call) RunAndReturn(run func() *url.URL) *GithubClient_GithubBaseURL_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListEntityHooks provides a mock function with given fields: ctx, opts
|
// ListEntityHooks provides a mock function with given fields: ctx, opts
|
||||||
func (_m *GithubClient) ListEntityHooks(ctx context.Context, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) {
|
func (_m *GithubClient) ListEntityHooks(ctx context.Context, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) {
|
||||||
ret := _m.Called(ctx, opts)
|
ret := _m.Called(ctx, opts)
|
||||||
|
|
@ -302,6 +541,35 @@ func (_m *GithubClient) ListEntityHooks(ctx context.Context, opts *github.ListOp
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_ListEntityHooks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityHooks'
|
||||||
|
type GithubClient_ListEntityHooks_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListEntityHooks is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - opts *github.ListOptions
|
||||||
|
func (_e *GithubClient_Expecter) ListEntityHooks(ctx interface{}, opts interface{}) *GithubClient_ListEntityHooks_Call {
|
||||||
|
return &GithubClient_ListEntityHooks_Call{Call: _e.mock.On("ListEntityHooks", ctx, opts)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_ListEntityHooks_Call) Run(run func(ctx context.Context, opts *github.ListOptions)) *GithubClient_ListEntityHooks_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*github.ListOptions))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_ListEntityHooks_Call) Return(ret []*github.Hook, response *github.Response, err error) *GithubClient_ListEntityHooks_Call {
|
||||||
|
_c.Call.Return(ret, response, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_ListEntityHooks_Call) RunAndReturn(run func(context.Context, *github.ListOptions) ([]*github.Hook, *github.Response, error)) *GithubClient_ListEntityHooks_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListEntityRunnerApplicationDownloads provides a mock function with given fields: ctx
|
// ListEntityRunnerApplicationDownloads provides a mock function with given fields: ctx
|
||||||
func (_m *GithubClient) ListEntityRunnerApplicationDownloads(ctx context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error) {
|
func (_m *GithubClient) ListEntityRunnerApplicationDownloads(ctx context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error) {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
|
|
@ -341,6 +609,34 @@ func (_m *GithubClient) ListEntityRunnerApplicationDownloads(ctx context.Context
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_ListEntityRunnerApplicationDownloads_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityRunnerApplicationDownloads'
|
||||||
|
type GithubClient_ListEntityRunnerApplicationDownloads_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListEntityRunnerApplicationDownloads is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *GithubClient_Expecter) ListEntityRunnerApplicationDownloads(ctx interface{}) *GithubClient_ListEntityRunnerApplicationDownloads_Call {
|
||||||
|
return &GithubClient_ListEntityRunnerApplicationDownloads_Call{Call: _e.mock.On("ListEntityRunnerApplicationDownloads", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_ListEntityRunnerApplicationDownloads_Call) Run(run func(ctx context.Context)) *GithubClient_ListEntityRunnerApplicationDownloads_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_ListEntityRunnerApplicationDownloads_Call) Return(_a0 []*github.RunnerApplicationDownload, _a1 *github.Response, _a2 error) *GithubClient_ListEntityRunnerApplicationDownloads_Call {
|
||||||
|
_c.Call.Return(_a0, _a1, _a2)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_ListEntityRunnerApplicationDownloads_Call) RunAndReturn(run func(context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error)) *GithubClient_ListEntityRunnerApplicationDownloads_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListEntityRunners provides a mock function with given fields: ctx, opts
|
// ListEntityRunners provides a mock function with given fields: ctx, opts
|
||||||
func (_m *GithubClient) ListEntityRunners(ctx context.Context, opts *github.ListRunnersOptions) (*github.Runners, *github.Response, error) {
|
func (_m *GithubClient) ListEntityRunners(ctx context.Context, opts *github.ListRunnersOptions) (*github.Runners, *github.Response, error) {
|
||||||
ret := _m.Called(ctx, opts)
|
ret := _m.Called(ctx, opts)
|
||||||
|
|
@ -380,6 +676,35 @@ func (_m *GithubClient) ListEntityRunners(ctx context.Context, opts *github.List
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_ListEntityRunners_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityRunners'
|
||||||
|
type GithubClient_ListEntityRunners_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListEntityRunners is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - opts *github.ListRunnersOptions
|
||||||
|
func (_e *GithubClient_Expecter) ListEntityRunners(ctx interface{}, opts interface{}) *GithubClient_ListEntityRunners_Call {
|
||||||
|
return &GithubClient_ListEntityRunners_Call{Call: _e.mock.On("ListEntityRunners", ctx, opts)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_ListEntityRunners_Call) Run(run func(ctx context.Context, opts *github.ListRunnersOptions)) *GithubClient_ListEntityRunners_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*github.ListRunnersOptions))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_ListEntityRunners_Call) Return(_a0 *github.Runners, _a1 *github.Response, _a2 error) *GithubClient_ListEntityRunners_Call {
|
||||||
|
_c.Call.Return(_a0, _a1, _a2)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_ListEntityRunners_Call) RunAndReturn(run func(context.Context, *github.ListRunnersOptions) (*github.Runners, *github.Response, error)) *GithubClient_ListEntityRunners_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// PingEntityHook provides a mock function with given fields: ctx, id
|
// PingEntityHook provides a mock function with given fields: ctx, id
|
||||||
func (_m *GithubClient) PingEntityHook(ctx context.Context, id int64) (*github.Response, error) {
|
func (_m *GithubClient) PingEntityHook(ctx context.Context, id int64) (*github.Response, error) {
|
||||||
ret := _m.Called(ctx, id)
|
ret := _m.Called(ctx, id)
|
||||||
|
|
@ -410,6 +735,35 @@ func (_m *GithubClient) PingEntityHook(ctx context.Context, id int64) (*github.R
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_PingEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PingEntityHook'
|
||||||
|
type GithubClient_PingEntityHook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// PingEntityHook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - id int64
|
||||||
|
func (_e *GithubClient_Expecter) PingEntityHook(ctx interface{}, id interface{}) *GithubClient_PingEntityHook_Call {
|
||||||
|
return &GithubClient_PingEntityHook_Call{Call: _e.mock.On("PingEntityHook", ctx, id)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_PingEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubClient_PingEntityHook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_PingEntityHook_Call) Return(ret *github.Response, err error) *GithubClient_PingEntityHook_Call {
|
||||||
|
_c.Call.Return(ret, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_PingEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Response, error)) *GithubClient_PingEntityHook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RateLimit provides a mock function with given fields: ctx
|
// RateLimit provides a mock function with given fields: ctx
|
||||||
func (_m *GithubClient) RateLimit(ctx context.Context) (*github.RateLimits, error) {
|
func (_m *GithubClient) RateLimit(ctx context.Context) (*github.RateLimits, error) {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
|
|
@ -440,6 +794,34 @@ func (_m *GithubClient) RateLimit(ctx context.Context) (*github.RateLimits, erro
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_RateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RateLimit'
|
||||||
|
type GithubClient_RateLimit_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RateLimit is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *GithubClient_Expecter) RateLimit(ctx interface{}) *GithubClient_RateLimit_Call {
|
||||||
|
return &GithubClient_RateLimit_Call{Call: _e.mock.On("RateLimit", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_RateLimit_Call) Run(run func(ctx context.Context)) *GithubClient_RateLimit_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_RateLimit_Call) Return(_a0 *github.RateLimits, _a1 error) *GithubClient_RateLimit_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_RateLimit_Call) RunAndReturn(run func(context.Context) (*github.RateLimits, error)) *GithubClient_RateLimit_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RemoveEntityRunner provides a mock function with given fields: ctx, runnerID
|
// RemoveEntityRunner provides a mock function with given fields: ctx, runnerID
|
||||||
func (_m *GithubClient) RemoveEntityRunner(ctx context.Context, runnerID int64) error {
|
func (_m *GithubClient) RemoveEntityRunner(ctx context.Context, runnerID int64) error {
|
||||||
ret := _m.Called(ctx, runnerID)
|
ret := _m.Called(ctx, runnerID)
|
||||||
|
|
@ -458,6 +840,35 @@ func (_m *GithubClient) RemoveEntityRunner(ctx context.Context, runnerID int64)
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubClient_RemoveEntityRunner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveEntityRunner'
|
||||||
|
type GithubClient_RemoveEntityRunner_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveEntityRunner is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - runnerID int64
|
||||||
|
func (_e *GithubClient_Expecter) RemoveEntityRunner(ctx interface{}, runnerID interface{}) *GithubClient_RemoveEntityRunner_Call {
|
||||||
|
return &GithubClient_RemoveEntityRunner_Call{Call: _e.mock.On("RemoveEntityRunner", ctx, runnerID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_RemoveEntityRunner_Call) Run(run func(ctx context.Context, runnerID int64)) *GithubClient_RemoveEntityRunner_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_RemoveEntityRunner_Call) Return(_a0 error) *GithubClient_RemoveEntityRunner_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubClient_RemoveEntityRunner_Call) RunAndReturn(run func(context.Context, int64) error) *GithubClient_RemoveEntityRunner_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// NewGithubClient creates a new instance of GithubClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
// NewGithubClient creates a new instance of GithubClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||||
// The first argument is typically a *testing.T value.
|
// The first argument is typically a *testing.T value.
|
||||||
func NewGithubClient(t interface {
|
func NewGithubClient(t interface {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
// Code generated by mockery. DO NOT EDIT.
|
||||||
|
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
|
|
@ -18,6 +18,14 @@ type GithubEntityOperations struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GithubEntityOperations_Expecter struct {
|
||||||
|
mock *mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_m *GithubEntityOperations) EXPECT() *GithubEntityOperations_Expecter {
|
||||||
|
return &GithubEntityOperations_Expecter{mock: &_m.Mock}
|
||||||
|
}
|
||||||
|
|
||||||
// CreateEntityHook provides a mock function with given fields: ctx, hook
|
// CreateEntityHook provides a mock function with given fields: ctx, hook
|
||||||
func (_m *GithubEntityOperations) CreateEntityHook(ctx context.Context, hook *github.Hook) (*github.Hook, error) {
|
func (_m *GithubEntityOperations) CreateEntityHook(ctx context.Context, hook *github.Hook) (*github.Hook, error) {
|
||||||
ret := _m.Called(ctx, hook)
|
ret := _m.Called(ctx, hook)
|
||||||
|
|
@ -48,6 +56,35 @@ func (_m *GithubEntityOperations) CreateEntityHook(ctx context.Context, hook *gi
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_CreateEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityHook'
|
||||||
|
type GithubEntityOperations_CreateEntityHook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateEntityHook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - hook *github.Hook
|
||||||
|
func (_e *GithubEntityOperations_Expecter) CreateEntityHook(ctx interface{}, hook interface{}) *GithubEntityOperations_CreateEntityHook_Call {
|
||||||
|
return &GithubEntityOperations_CreateEntityHook_Call{Call: _e.mock.On("CreateEntityHook", ctx, hook)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_CreateEntityHook_Call) Run(run func(ctx context.Context, hook *github.Hook)) *GithubEntityOperations_CreateEntityHook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*github.Hook))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_CreateEntityHook_Call) Return(ret *github.Hook, err error) *GithubEntityOperations_CreateEntityHook_Call {
|
||||||
|
_c.Call.Return(ret, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_CreateEntityHook_Call) RunAndReturn(run func(context.Context, *github.Hook) (*github.Hook, error)) *GithubEntityOperations_CreateEntityHook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// CreateEntityRegistrationToken provides a mock function with given fields: ctx
|
// CreateEntityRegistrationToken provides a mock function with given fields: ctx
|
||||||
func (_m *GithubEntityOperations) CreateEntityRegistrationToken(ctx context.Context) (*github.RegistrationToken, *github.Response, error) {
|
func (_m *GithubEntityOperations) CreateEntityRegistrationToken(ctx context.Context) (*github.RegistrationToken, *github.Response, error) {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
|
|
@ -87,6 +124,34 @@ func (_m *GithubEntityOperations) CreateEntityRegistrationToken(ctx context.Cont
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_CreateEntityRegistrationToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEntityRegistrationToken'
|
||||||
|
type GithubEntityOperations_CreateEntityRegistrationToken_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateEntityRegistrationToken is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *GithubEntityOperations_Expecter) CreateEntityRegistrationToken(ctx interface{}) *GithubEntityOperations_CreateEntityRegistrationToken_Call {
|
||||||
|
return &GithubEntityOperations_CreateEntityRegistrationToken_Call{Call: _e.mock.On("CreateEntityRegistrationToken", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_CreateEntityRegistrationToken_Call) Run(run func(ctx context.Context)) *GithubEntityOperations_CreateEntityRegistrationToken_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_CreateEntityRegistrationToken_Call) Return(_a0 *github.RegistrationToken, _a1 *github.Response, _a2 error) *GithubEntityOperations_CreateEntityRegistrationToken_Call {
|
||||||
|
_c.Call.Return(_a0, _a1, _a2)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_CreateEntityRegistrationToken_Call) RunAndReturn(run func(context.Context) (*github.RegistrationToken, *github.Response, error)) *GithubEntityOperations_CreateEntityRegistrationToken_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// DeleteEntityHook provides a mock function with given fields: ctx, id
|
// DeleteEntityHook provides a mock function with given fields: ctx, id
|
||||||
func (_m *GithubEntityOperations) DeleteEntityHook(ctx context.Context, id int64) (*github.Response, error) {
|
func (_m *GithubEntityOperations) DeleteEntityHook(ctx context.Context, id int64) (*github.Response, error) {
|
||||||
ret := _m.Called(ctx, id)
|
ret := _m.Called(ctx, id)
|
||||||
|
|
@ -117,6 +182,35 @@ func (_m *GithubEntityOperations) DeleteEntityHook(ctx context.Context, id int64
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_DeleteEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEntityHook'
|
||||||
|
type GithubEntityOperations_DeleteEntityHook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteEntityHook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - id int64
|
||||||
|
func (_e *GithubEntityOperations_Expecter) DeleteEntityHook(ctx interface{}, id interface{}) *GithubEntityOperations_DeleteEntityHook_Call {
|
||||||
|
return &GithubEntityOperations_DeleteEntityHook_Call{Call: _e.mock.On("DeleteEntityHook", ctx, id)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_DeleteEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubEntityOperations_DeleteEntityHook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_DeleteEntityHook_Call) Return(ret *github.Response, err error) *GithubEntityOperations_DeleteEntityHook_Call {
|
||||||
|
_c.Call.Return(ret, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_DeleteEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Response, error)) *GithubEntityOperations_DeleteEntityHook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetEntity provides a mock function with no fields
|
// GetEntity provides a mock function with no fields
|
||||||
func (_m *GithubEntityOperations) GetEntity() params.ForgeEntity {
|
func (_m *GithubEntityOperations) GetEntity() params.ForgeEntity {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -135,6 +229,33 @@ func (_m *GithubEntityOperations) GetEntity() params.ForgeEntity {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_GetEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntity'
|
||||||
|
type GithubEntityOperations_GetEntity_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEntity is a helper method to define mock.On call
|
||||||
|
func (_e *GithubEntityOperations_Expecter) GetEntity() *GithubEntityOperations_GetEntity_Call {
|
||||||
|
return &GithubEntityOperations_GetEntity_Call{Call: _e.mock.On("GetEntity")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GetEntity_Call) Run(run func()) *GithubEntityOperations_GetEntity_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GetEntity_Call) Return(_a0 params.ForgeEntity) *GithubEntityOperations_GetEntity_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GetEntity_Call) RunAndReturn(run func() params.ForgeEntity) *GithubEntityOperations_GetEntity_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetEntityHook provides a mock function with given fields: ctx, id
|
// GetEntityHook provides a mock function with given fields: ctx, id
|
||||||
func (_m *GithubEntityOperations) GetEntityHook(ctx context.Context, id int64) (*github.Hook, error) {
|
func (_m *GithubEntityOperations) GetEntityHook(ctx context.Context, id int64) (*github.Hook, error) {
|
||||||
ret := _m.Called(ctx, id)
|
ret := _m.Called(ctx, id)
|
||||||
|
|
@ -165,6 +286,35 @@ func (_m *GithubEntityOperations) GetEntityHook(ctx context.Context, id int64) (
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_GetEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntityHook'
|
||||||
|
type GithubEntityOperations_GetEntityHook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEntityHook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - id int64
|
||||||
|
func (_e *GithubEntityOperations_Expecter) GetEntityHook(ctx interface{}, id interface{}) *GithubEntityOperations_GetEntityHook_Call {
|
||||||
|
return &GithubEntityOperations_GetEntityHook_Call{Call: _e.mock.On("GetEntityHook", ctx, id)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GetEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubEntityOperations_GetEntityHook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GetEntityHook_Call) Return(ret *github.Hook, err error) *GithubEntityOperations_GetEntityHook_Call {
|
||||||
|
_c.Call.Return(ret, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GetEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Hook, error)) *GithubEntityOperations_GetEntityHook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetEntityJITConfig provides a mock function with given fields: ctx, instance, pool, labels
|
// GetEntityJITConfig provides a mock function with given fields: ctx, instance, pool, labels
|
||||||
func (_m *GithubEntityOperations) GetEntityJITConfig(ctx context.Context, instance string, pool params.Pool, labels []string) (map[string]string, *github.Runner, error) {
|
func (_m *GithubEntityOperations) GetEntityJITConfig(ctx context.Context, instance string, pool params.Pool, labels []string) (map[string]string, *github.Runner, error) {
|
||||||
ret := _m.Called(ctx, instance, pool, labels)
|
ret := _m.Called(ctx, instance, pool, labels)
|
||||||
|
|
@ -204,6 +354,37 @@ func (_m *GithubEntityOperations) GetEntityJITConfig(ctx context.Context, instan
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_GetEntityJITConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEntityJITConfig'
|
||||||
|
type GithubEntityOperations_GetEntityJITConfig_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEntityJITConfig is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - instance string
|
||||||
|
// - pool params.Pool
|
||||||
|
// - labels []string
|
||||||
|
func (_e *GithubEntityOperations_Expecter) GetEntityJITConfig(ctx interface{}, instance interface{}, pool interface{}, labels interface{}) *GithubEntityOperations_GetEntityJITConfig_Call {
|
||||||
|
return &GithubEntityOperations_GetEntityJITConfig_Call{Call: _e.mock.On("GetEntityJITConfig", ctx, instance, pool, labels)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GetEntityJITConfig_Call) Run(run func(ctx context.Context, instance string, pool params.Pool, labels []string)) *GithubEntityOperations_GetEntityJITConfig_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(string), args[2].(params.Pool), args[3].([]string))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GetEntityJITConfig_Call) Return(jitConfigMap map[string]string, runner *github.Runner, err error) *GithubEntityOperations_GetEntityJITConfig_Call {
|
||||||
|
_c.Call.Return(jitConfigMap, runner, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GetEntityJITConfig_Call) RunAndReturn(run func(context.Context, string, params.Pool, []string) (map[string]string, *github.Runner, error)) *GithubEntityOperations_GetEntityJITConfig_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GithubBaseURL provides a mock function with no fields
|
// GithubBaseURL provides a mock function with no fields
|
||||||
func (_m *GithubEntityOperations) GithubBaseURL() *url.URL {
|
func (_m *GithubEntityOperations) GithubBaseURL() *url.URL {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -224,6 +405,33 @@ func (_m *GithubEntityOperations) GithubBaseURL() *url.URL {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_GithubBaseURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GithubBaseURL'
|
||||||
|
type GithubEntityOperations_GithubBaseURL_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GithubBaseURL is a helper method to define mock.On call
|
||||||
|
func (_e *GithubEntityOperations_Expecter) GithubBaseURL() *GithubEntityOperations_GithubBaseURL_Call {
|
||||||
|
return &GithubEntityOperations_GithubBaseURL_Call{Call: _e.mock.On("GithubBaseURL")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GithubBaseURL_Call) Run(run func()) *GithubEntityOperations_GithubBaseURL_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GithubBaseURL_Call) Return(_a0 *url.URL) *GithubEntityOperations_GithubBaseURL_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_GithubBaseURL_Call) RunAndReturn(run func() *url.URL) *GithubEntityOperations_GithubBaseURL_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListEntityHooks provides a mock function with given fields: ctx, opts
|
// ListEntityHooks provides a mock function with given fields: ctx, opts
|
||||||
func (_m *GithubEntityOperations) ListEntityHooks(ctx context.Context, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) {
|
func (_m *GithubEntityOperations) ListEntityHooks(ctx context.Context, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) {
|
||||||
ret := _m.Called(ctx, opts)
|
ret := _m.Called(ctx, opts)
|
||||||
|
|
@ -263,6 +471,35 @@ func (_m *GithubEntityOperations) ListEntityHooks(ctx context.Context, opts *git
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_ListEntityHooks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityHooks'
|
||||||
|
type GithubEntityOperations_ListEntityHooks_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListEntityHooks is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - opts *github.ListOptions
|
||||||
|
func (_e *GithubEntityOperations_Expecter) ListEntityHooks(ctx interface{}, opts interface{}) *GithubEntityOperations_ListEntityHooks_Call {
|
||||||
|
return &GithubEntityOperations_ListEntityHooks_Call{Call: _e.mock.On("ListEntityHooks", ctx, opts)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_ListEntityHooks_Call) Run(run func(ctx context.Context, opts *github.ListOptions)) *GithubEntityOperations_ListEntityHooks_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*github.ListOptions))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_ListEntityHooks_Call) Return(ret []*github.Hook, response *github.Response, err error) *GithubEntityOperations_ListEntityHooks_Call {
|
||||||
|
_c.Call.Return(ret, response, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_ListEntityHooks_Call) RunAndReturn(run func(context.Context, *github.ListOptions) ([]*github.Hook, *github.Response, error)) *GithubEntityOperations_ListEntityHooks_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListEntityRunnerApplicationDownloads provides a mock function with given fields: ctx
|
// ListEntityRunnerApplicationDownloads provides a mock function with given fields: ctx
|
||||||
func (_m *GithubEntityOperations) ListEntityRunnerApplicationDownloads(ctx context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error) {
|
func (_m *GithubEntityOperations) ListEntityRunnerApplicationDownloads(ctx context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error) {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
|
|
@ -302,6 +539,34 @@ func (_m *GithubEntityOperations) ListEntityRunnerApplicationDownloads(ctx conte
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityRunnerApplicationDownloads'
|
||||||
|
type GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListEntityRunnerApplicationDownloads is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *GithubEntityOperations_Expecter) ListEntityRunnerApplicationDownloads(ctx interface{}) *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call {
|
||||||
|
return &GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call{Call: _e.mock.On("ListEntityRunnerApplicationDownloads", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call) Run(run func(ctx context.Context)) *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call) Return(_a0 []*github.RunnerApplicationDownload, _a1 *github.Response, _a2 error) *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call {
|
||||||
|
_c.Call.Return(_a0, _a1, _a2)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call) RunAndReturn(run func(context.Context) ([]*github.RunnerApplicationDownload, *github.Response, error)) *GithubEntityOperations_ListEntityRunnerApplicationDownloads_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListEntityRunners provides a mock function with given fields: ctx, opts
|
// ListEntityRunners provides a mock function with given fields: ctx, opts
|
||||||
func (_m *GithubEntityOperations) ListEntityRunners(ctx context.Context, opts *github.ListRunnersOptions) (*github.Runners, *github.Response, error) {
|
func (_m *GithubEntityOperations) ListEntityRunners(ctx context.Context, opts *github.ListRunnersOptions) (*github.Runners, *github.Response, error) {
|
||||||
ret := _m.Called(ctx, opts)
|
ret := _m.Called(ctx, opts)
|
||||||
|
|
@ -341,6 +606,35 @@ func (_m *GithubEntityOperations) ListEntityRunners(ctx context.Context, opts *g
|
||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_ListEntityRunners_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEntityRunners'
|
||||||
|
type GithubEntityOperations_ListEntityRunners_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListEntityRunners is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - opts *github.ListRunnersOptions
|
||||||
|
func (_e *GithubEntityOperations_Expecter) ListEntityRunners(ctx interface{}, opts interface{}) *GithubEntityOperations_ListEntityRunners_Call {
|
||||||
|
return &GithubEntityOperations_ListEntityRunners_Call{Call: _e.mock.On("ListEntityRunners", ctx, opts)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_ListEntityRunners_Call) Run(run func(ctx context.Context, opts *github.ListRunnersOptions)) *GithubEntityOperations_ListEntityRunners_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*github.ListRunnersOptions))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_ListEntityRunners_Call) Return(_a0 *github.Runners, _a1 *github.Response, _a2 error) *GithubEntityOperations_ListEntityRunners_Call {
|
||||||
|
_c.Call.Return(_a0, _a1, _a2)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_ListEntityRunners_Call) RunAndReturn(run func(context.Context, *github.ListRunnersOptions) (*github.Runners, *github.Response, error)) *GithubEntityOperations_ListEntityRunners_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// PingEntityHook provides a mock function with given fields: ctx, id
|
// PingEntityHook provides a mock function with given fields: ctx, id
|
||||||
func (_m *GithubEntityOperations) PingEntityHook(ctx context.Context, id int64) (*github.Response, error) {
|
func (_m *GithubEntityOperations) PingEntityHook(ctx context.Context, id int64) (*github.Response, error) {
|
||||||
ret := _m.Called(ctx, id)
|
ret := _m.Called(ctx, id)
|
||||||
|
|
@ -371,6 +665,35 @@ func (_m *GithubEntityOperations) PingEntityHook(ctx context.Context, id int64)
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_PingEntityHook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PingEntityHook'
|
||||||
|
type GithubEntityOperations_PingEntityHook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// PingEntityHook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - id int64
|
||||||
|
func (_e *GithubEntityOperations_Expecter) PingEntityHook(ctx interface{}, id interface{}) *GithubEntityOperations_PingEntityHook_Call {
|
||||||
|
return &GithubEntityOperations_PingEntityHook_Call{Call: _e.mock.On("PingEntityHook", ctx, id)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_PingEntityHook_Call) Run(run func(ctx context.Context, id int64)) *GithubEntityOperations_PingEntityHook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_PingEntityHook_Call) Return(ret *github.Response, err error) *GithubEntityOperations_PingEntityHook_Call {
|
||||||
|
_c.Call.Return(ret, err)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_PingEntityHook_Call) RunAndReturn(run func(context.Context, int64) (*github.Response, error)) *GithubEntityOperations_PingEntityHook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RateLimit provides a mock function with given fields: ctx
|
// RateLimit provides a mock function with given fields: ctx
|
||||||
func (_m *GithubEntityOperations) RateLimit(ctx context.Context) (*github.RateLimits, error) {
|
func (_m *GithubEntityOperations) RateLimit(ctx context.Context) (*github.RateLimits, error) {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
|
|
@ -401,6 +724,34 @@ func (_m *GithubEntityOperations) RateLimit(ctx context.Context) (*github.RateLi
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_RateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RateLimit'
|
||||||
|
type GithubEntityOperations_RateLimit_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RateLimit is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *GithubEntityOperations_Expecter) RateLimit(ctx interface{}) *GithubEntityOperations_RateLimit_Call {
|
||||||
|
return &GithubEntityOperations_RateLimit_Call{Call: _e.mock.On("RateLimit", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_RateLimit_Call) Run(run func(ctx context.Context)) *GithubEntityOperations_RateLimit_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_RateLimit_Call) Return(_a0 *github.RateLimits, _a1 error) *GithubEntityOperations_RateLimit_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_RateLimit_Call) RunAndReturn(run func(context.Context) (*github.RateLimits, error)) *GithubEntityOperations_RateLimit_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RemoveEntityRunner provides a mock function with given fields: ctx, runnerID
|
// RemoveEntityRunner provides a mock function with given fields: ctx, runnerID
|
||||||
func (_m *GithubEntityOperations) RemoveEntityRunner(ctx context.Context, runnerID int64) error {
|
func (_m *GithubEntityOperations) RemoveEntityRunner(ctx context.Context, runnerID int64) error {
|
||||||
ret := _m.Called(ctx, runnerID)
|
ret := _m.Called(ctx, runnerID)
|
||||||
|
|
@ -419,6 +770,35 @@ func (_m *GithubEntityOperations) RemoveEntityRunner(ctx context.Context, runner
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GithubEntityOperations_RemoveEntityRunner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveEntityRunner'
|
||||||
|
type GithubEntityOperations_RemoveEntityRunner_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveEntityRunner is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - runnerID int64
|
||||||
|
func (_e *GithubEntityOperations_Expecter) RemoveEntityRunner(ctx interface{}, runnerID interface{}) *GithubEntityOperations_RemoveEntityRunner_Call {
|
||||||
|
return &GithubEntityOperations_RemoveEntityRunner_Call{Call: _e.mock.On("RemoveEntityRunner", ctx, runnerID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_RemoveEntityRunner_Call) Run(run func(ctx context.Context, runnerID int64)) *GithubEntityOperations_RemoveEntityRunner_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_RemoveEntityRunner_Call) Return(_a0 error) *GithubEntityOperations_RemoveEntityRunner_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *GithubEntityOperations_RemoveEntityRunner_Call) RunAndReturn(run func(context.Context, int64) error) *GithubEntityOperations_RemoveEntityRunner_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// NewGithubEntityOperations creates a new instance of GithubEntityOperations. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
// NewGithubEntityOperations creates a new instance of GithubEntityOperations. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||||
// The first argument is typically a *testing.T value.
|
// The first argument is typically a *testing.T value.
|
||||||
func NewGithubEntityOperations(t interface {
|
func NewGithubEntityOperations(t interface {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
// Code generated by mockery. DO NOT EDIT.
|
||||||
|
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
|
|
@ -14,6 +14,14 @@ type PoolManager struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PoolManager_Expecter struct {
|
||||||
|
mock *mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_m *PoolManager) EXPECT() *PoolManager_Expecter {
|
||||||
|
return &PoolManager_Expecter{mock: &_m.Mock}
|
||||||
|
}
|
||||||
|
|
||||||
// GetWebhookInfo provides a mock function with given fields: ctx
|
// GetWebhookInfo provides a mock function with given fields: ctx
|
||||||
func (_m *PoolManager) GetWebhookInfo(ctx context.Context) (params.HookInfo, error) {
|
func (_m *PoolManager) GetWebhookInfo(ctx context.Context) (params.HookInfo, error) {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
|
|
@ -42,6 +50,34 @@ func (_m *PoolManager) GetWebhookInfo(ctx context.Context) (params.HookInfo, err
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_GetWebhookInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWebhookInfo'
|
||||||
|
type PoolManager_GetWebhookInfo_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetWebhookInfo is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *PoolManager_Expecter) GetWebhookInfo(ctx interface{}) *PoolManager_GetWebhookInfo_Call {
|
||||||
|
return &PoolManager_GetWebhookInfo_Call{Call: _e.mock.On("GetWebhookInfo", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_GetWebhookInfo_Call) Run(run func(ctx context.Context)) *PoolManager_GetWebhookInfo_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_GetWebhookInfo_Call) Return(_a0 params.HookInfo, _a1 error) *PoolManager_GetWebhookInfo_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_GetWebhookInfo_Call) RunAndReturn(run func(context.Context) (params.HookInfo, error)) *PoolManager_GetWebhookInfo_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GithubRunnerRegistrationToken provides a mock function with no fields
|
// GithubRunnerRegistrationToken provides a mock function with no fields
|
||||||
func (_m *PoolManager) GithubRunnerRegistrationToken() (string, error) {
|
func (_m *PoolManager) GithubRunnerRegistrationToken() (string, error) {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -70,6 +106,33 @@ func (_m *PoolManager) GithubRunnerRegistrationToken() (string, error) {
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_GithubRunnerRegistrationToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GithubRunnerRegistrationToken'
|
||||||
|
type PoolManager_GithubRunnerRegistrationToken_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GithubRunnerRegistrationToken is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManager_Expecter) GithubRunnerRegistrationToken() *PoolManager_GithubRunnerRegistrationToken_Call {
|
||||||
|
return &PoolManager_GithubRunnerRegistrationToken_Call{Call: _e.mock.On("GithubRunnerRegistrationToken")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_GithubRunnerRegistrationToken_Call) Run(run func()) *PoolManager_GithubRunnerRegistrationToken_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_GithubRunnerRegistrationToken_Call) Return(_a0 string, _a1 error) *PoolManager_GithubRunnerRegistrationToken_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_GithubRunnerRegistrationToken_Call) RunAndReturn(run func() (string, error)) *PoolManager_GithubRunnerRegistrationToken_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// HandleWorkflowJob provides a mock function with given fields: job
|
// HandleWorkflowJob provides a mock function with given fields: job
|
||||||
func (_m *PoolManager) HandleWorkflowJob(job params.WorkflowJob) error {
|
func (_m *PoolManager) HandleWorkflowJob(job params.WorkflowJob) error {
|
||||||
ret := _m.Called(job)
|
ret := _m.Called(job)
|
||||||
|
|
@ -88,6 +151,34 @@ func (_m *PoolManager) HandleWorkflowJob(job params.WorkflowJob) error {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_HandleWorkflowJob_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HandleWorkflowJob'
|
||||||
|
type PoolManager_HandleWorkflowJob_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// HandleWorkflowJob is a helper method to define mock.On call
|
||||||
|
// - job params.WorkflowJob
|
||||||
|
func (_e *PoolManager_Expecter) HandleWorkflowJob(job interface{}) *PoolManager_HandleWorkflowJob_Call {
|
||||||
|
return &PoolManager_HandleWorkflowJob_Call{Call: _e.mock.On("HandleWorkflowJob", job)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_HandleWorkflowJob_Call) Run(run func(job params.WorkflowJob)) *PoolManager_HandleWorkflowJob_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(params.WorkflowJob))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_HandleWorkflowJob_Call) Return(_a0 error) *PoolManager_HandleWorkflowJob_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_HandleWorkflowJob_Call) RunAndReturn(run func(params.WorkflowJob) error) *PoolManager_HandleWorkflowJob_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ID provides a mock function with no fields
|
// ID provides a mock function with no fields
|
||||||
func (_m *PoolManager) ID() string {
|
func (_m *PoolManager) ID() string {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -106,6 +197,33 @@ func (_m *PoolManager) ID() string {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID'
|
||||||
|
type PoolManager_ID_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ID is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManager_Expecter) ID() *PoolManager_ID_Call {
|
||||||
|
return &PoolManager_ID_Call{Call: _e.mock.On("ID")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_ID_Call) Run(run func()) *PoolManager_ID_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_ID_Call) Return(_a0 string) *PoolManager_ID_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_ID_Call) RunAndReturn(run func() string) *PoolManager_ID_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// InstallWebhook provides a mock function with given fields: ctx, param
|
// InstallWebhook provides a mock function with given fields: ctx, param
|
||||||
func (_m *PoolManager) InstallWebhook(ctx context.Context, param params.InstallWebhookParams) (params.HookInfo, error) {
|
func (_m *PoolManager) InstallWebhook(ctx context.Context, param params.InstallWebhookParams) (params.HookInfo, error) {
|
||||||
ret := _m.Called(ctx, param)
|
ret := _m.Called(ctx, param)
|
||||||
|
|
@ -134,6 +252,35 @@ func (_m *PoolManager) InstallWebhook(ctx context.Context, param params.InstallW
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_InstallWebhook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InstallWebhook'
|
||||||
|
type PoolManager_InstallWebhook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// InstallWebhook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - param params.InstallWebhookParams
|
||||||
|
func (_e *PoolManager_Expecter) InstallWebhook(ctx interface{}, param interface{}) *PoolManager_InstallWebhook_Call {
|
||||||
|
return &PoolManager_InstallWebhook_Call{Call: _e.mock.On("InstallWebhook", ctx, param)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_InstallWebhook_Call) Run(run func(ctx context.Context, param params.InstallWebhookParams)) *PoolManager_InstallWebhook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(params.InstallWebhookParams))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_InstallWebhook_Call) Return(_a0 params.HookInfo, _a1 error) *PoolManager_InstallWebhook_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_InstallWebhook_Call) RunAndReturn(run func(context.Context, params.InstallWebhookParams) (params.HookInfo, error)) *PoolManager_InstallWebhook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RootCABundle provides a mock function with no fields
|
// RootCABundle provides a mock function with no fields
|
||||||
func (_m *PoolManager) RootCABundle() (params.CertificateBundle, error) {
|
func (_m *PoolManager) RootCABundle() (params.CertificateBundle, error) {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -162,11 +309,67 @@ func (_m *PoolManager) RootCABundle() (params.CertificateBundle, error) {
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_RootCABundle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RootCABundle'
|
||||||
|
type PoolManager_RootCABundle_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RootCABundle is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManager_Expecter) RootCABundle() *PoolManager_RootCABundle_Call {
|
||||||
|
return &PoolManager_RootCABundle_Call{Call: _e.mock.On("RootCABundle")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_RootCABundle_Call) Run(run func()) *PoolManager_RootCABundle_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_RootCABundle_Call) Return(_a0 params.CertificateBundle, _a1 error) *PoolManager_RootCABundle_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_RootCABundle_Call) RunAndReturn(run func() (params.CertificateBundle, error)) *PoolManager_RootCABundle_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// SetPoolRunningState provides a mock function with given fields: isRunning, failureReason
|
// SetPoolRunningState provides a mock function with given fields: isRunning, failureReason
|
||||||
func (_m *PoolManager) SetPoolRunningState(isRunning bool, failureReason string) {
|
func (_m *PoolManager) SetPoolRunningState(isRunning bool, failureReason string) {
|
||||||
_m.Called(isRunning, failureReason)
|
_m.Called(isRunning, failureReason)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_SetPoolRunningState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetPoolRunningState'
|
||||||
|
type PoolManager_SetPoolRunningState_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPoolRunningState is a helper method to define mock.On call
|
||||||
|
// - isRunning bool
|
||||||
|
// - failureReason string
|
||||||
|
func (_e *PoolManager_Expecter) SetPoolRunningState(isRunning interface{}, failureReason interface{}) *PoolManager_SetPoolRunningState_Call {
|
||||||
|
return &PoolManager_SetPoolRunningState_Call{Call: _e.mock.On("SetPoolRunningState", isRunning, failureReason)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_SetPoolRunningState_Call) Run(run func(isRunning bool, failureReason string)) *PoolManager_SetPoolRunningState_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(bool), args[1].(string))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_SetPoolRunningState_Call) Return() *PoolManager_SetPoolRunningState_Call {
|
||||||
|
_c.Call.Return()
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_SetPoolRunningState_Call) RunAndReturn(run func(bool, string)) *PoolManager_SetPoolRunningState_Call {
|
||||||
|
_c.Run(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// Start provides a mock function with no fields
|
// Start provides a mock function with no fields
|
||||||
func (_m *PoolManager) Start() error {
|
func (_m *PoolManager) Start() error {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -185,6 +388,33 @@ func (_m *PoolManager) Start() error {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
||||||
|
type PoolManager_Start_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManager_Expecter) Start() *PoolManager_Start_Call {
|
||||||
|
return &PoolManager_Start_Call{Call: _e.mock.On("Start")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Start_Call) Run(run func()) *PoolManager_Start_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Start_Call) Return(_a0 error) *PoolManager_Start_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Start_Call) RunAndReturn(run func() error) *PoolManager_Start_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// Status provides a mock function with no fields
|
// Status provides a mock function with no fields
|
||||||
func (_m *PoolManager) Status() params.PoolManagerStatus {
|
func (_m *PoolManager) Status() params.PoolManagerStatus {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -203,6 +433,33 @@ func (_m *PoolManager) Status() params.PoolManagerStatus {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_Status_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Status'
|
||||||
|
type PoolManager_Status_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManager_Expecter) Status() *PoolManager_Status_Call {
|
||||||
|
return &PoolManager_Status_Call{Call: _e.mock.On("Status")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Status_Call) Run(run func()) *PoolManager_Status_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Status_Call) Return(_a0 params.PoolManagerStatus) *PoolManager_Status_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Status_Call) RunAndReturn(run func() params.PoolManagerStatus) *PoolManager_Status_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// Stop provides a mock function with no fields
|
// Stop provides a mock function with no fields
|
||||||
func (_m *PoolManager) Stop() error {
|
func (_m *PoolManager) Stop() error {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -221,6 +478,33 @@ func (_m *PoolManager) Stop() error {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
|
||||||
|
type PoolManager_Stop_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManager_Expecter) Stop() *PoolManager_Stop_Call {
|
||||||
|
return &PoolManager_Stop_Call{Call: _e.mock.On("Stop")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Stop_Call) Run(run func()) *PoolManager_Stop_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Stop_Call) Return(_a0 error) *PoolManager_Stop_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Stop_Call) RunAndReturn(run func() error) *PoolManager_Stop_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// UninstallWebhook provides a mock function with given fields: ctx
|
// UninstallWebhook provides a mock function with given fields: ctx
|
||||||
func (_m *PoolManager) UninstallWebhook(ctx context.Context) error {
|
func (_m *PoolManager) UninstallWebhook(ctx context.Context) error {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
|
|
@ -239,6 +523,34 @@ func (_m *PoolManager) UninstallWebhook(ctx context.Context) error {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_UninstallWebhook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UninstallWebhook'
|
||||||
|
type PoolManager_UninstallWebhook_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// UninstallWebhook is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *PoolManager_Expecter) UninstallWebhook(ctx interface{}) *PoolManager_UninstallWebhook_Call {
|
||||||
|
return &PoolManager_UninstallWebhook_Call{Call: _e.mock.On("UninstallWebhook", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_UninstallWebhook_Call) Run(run func(ctx context.Context)) *PoolManager_UninstallWebhook_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_UninstallWebhook_Call) Return(_a0 error) *PoolManager_UninstallWebhook_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_UninstallWebhook_Call) RunAndReturn(run func(context.Context) error) *PoolManager_UninstallWebhook_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// Wait provides a mock function with no fields
|
// Wait provides a mock function with no fields
|
||||||
func (_m *PoolManager) Wait() error {
|
func (_m *PoolManager) Wait() error {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -257,6 +569,33 @@ func (_m *PoolManager) Wait() error {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait'
|
||||||
|
type PoolManager_Wait_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManager_Expecter) Wait() *PoolManager_Wait_Call {
|
||||||
|
return &PoolManager_Wait_Call{Call: _e.mock.On("Wait")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Wait_Call) Run(run func()) *PoolManager_Wait_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Wait_Call) Return(_a0 error) *PoolManager_Wait_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_Wait_Call) RunAndReturn(run func() error) *PoolManager_Wait_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// WebhookSecret provides a mock function with no fields
|
// WebhookSecret provides a mock function with no fields
|
||||||
func (_m *PoolManager) WebhookSecret() string {
|
func (_m *PoolManager) WebhookSecret() string {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -275,6 +614,33 @@ func (_m *PoolManager) WebhookSecret() string {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManager_WebhookSecret_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WebhookSecret'
|
||||||
|
type PoolManager_WebhookSecret_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// WebhookSecret is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManager_Expecter) WebhookSecret() *PoolManager_WebhookSecret_Call {
|
||||||
|
return &PoolManager_WebhookSecret_Call{Call: _e.mock.On("WebhookSecret")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_WebhookSecret_Call) Run(run func()) *PoolManager_WebhookSecret_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_WebhookSecret_Call) Return(_a0 string) *PoolManager_WebhookSecret_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManager_WebhookSecret_Call) RunAndReturn(run func() string) *PoolManager_WebhookSecret_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// NewPoolManager creates a new instance of PoolManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
// NewPoolManager creates a new instance of PoolManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||||
// The first argument is typically a *testing.T value.
|
// The first argument is typically a *testing.T value.
|
||||||
func NewPoolManager(t interface {
|
func NewPoolManager(t interface {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
// Code generated by mockery. DO NOT EDIT.
|
||||||
|
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
|
|
@ -19,6 +19,14 @@ type Provider struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Provider_Expecter struct {
|
||||||
|
mock *mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_m *Provider) EXPECT() *Provider_Expecter {
|
||||||
|
return &Provider_Expecter{mock: &_m.Mock}
|
||||||
|
}
|
||||||
|
|
||||||
// AsParams provides a mock function with no fields
|
// AsParams provides a mock function with no fields
|
||||||
func (_m *Provider) AsParams() params.Provider {
|
func (_m *Provider) AsParams() params.Provider {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -37,6 +45,33 @@ func (_m *Provider) AsParams() params.Provider {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provider_AsParams_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AsParams'
|
||||||
|
type Provider_AsParams_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsParams is a helper method to define mock.On call
|
||||||
|
func (_e *Provider_Expecter) AsParams() *Provider_AsParams_Call {
|
||||||
|
return &Provider_AsParams_Call{Call: _e.mock.On("AsParams")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_AsParams_Call) Run(run func()) *Provider_AsParams_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_AsParams_Call) Return(_a0 params.Provider) *Provider_AsParams_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_AsParams_Call) RunAndReturn(run func() params.Provider) *Provider_AsParams_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// CreateInstance provides a mock function with given fields: ctx, bootstrapParams, createInstanceParams
|
// CreateInstance provides a mock function with given fields: ctx, bootstrapParams, createInstanceParams
|
||||||
func (_m *Provider) CreateInstance(ctx context.Context, bootstrapParams garm_provider_commonparams.BootstrapInstance, createInstanceParams common.CreateInstanceParams) (garm_provider_commonparams.ProviderInstance, error) {
|
func (_m *Provider) CreateInstance(ctx context.Context, bootstrapParams garm_provider_commonparams.BootstrapInstance, createInstanceParams common.CreateInstanceParams) (garm_provider_commonparams.ProviderInstance, error) {
|
||||||
ret := _m.Called(ctx, bootstrapParams, createInstanceParams)
|
ret := _m.Called(ctx, bootstrapParams, createInstanceParams)
|
||||||
|
|
@ -65,6 +100,36 @@ func (_m *Provider) CreateInstance(ctx context.Context, bootstrapParams garm_pro
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provider_CreateInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateInstance'
|
||||||
|
type Provider_CreateInstance_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateInstance is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - bootstrapParams garm_provider_commonparams.BootstrapInstance
|
||||||
|
// - createInstanceParams common.CreateInstanceParams
|
||||||
|
func (_e *Provider_Expecter) CreateInstance(ctx interface{}, bootstrapParams interface{}, createInstanceParams interface{}) *Provider_CreateInstance_Call {
|
||||||
|
return &Provider_CreateInstance_Call{Call: _e.mock.On("CreateInstance", ctx, bootstrapParams, createInstanceParams)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_CreateInstance_Call) Run(run func(ctx context.Context, bootstrapParams garm_provider_commonparams.BootstrapInstance, createInstanceParams common.CreateInstanceParams)) *Provider_CreateInstance_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(garm_provider_commonparams.BootstrapInstance), args[2].(common.CreateInstanceParams))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_CreateInstance_Call) Return(_a0 garm_provider_commonparams.ProviderInstance, _a1 error) *Provider_CreateInstance_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_CreateInstance_Call) RunAndReturn(run func(context.Context, garm_provider_commonparams.BootstrapInstance, common.CreateInstanceParams) (garm_provider_commonparams.ProviderInstance, error)) *Provider_CreateInstance_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// DeleteInstance provides a mock function with given fields: ctx, instance, deleteInstanceParams
|
// DeleteInstance provides a mock function with given fields: ctx, instance, deleteInstanceParams
|
||||||
func (_m *Provider) DeleteInstance(ctx context.Context, instance string, deleteInstanceParams common.DeleteInstanceParams) error {
|
func (_m *Provider) DeleteInstance(ctx context.Context, instance string, deleteInstanceParams common.DeleteInstanceParams) error {
|
||||||
ret := _m.Called(ctx, instance, deleteInstanceParams)
|
ret := _m.Called(ctx, instance, deleteInstanceParams)
|
||||||
|
|
@ -83,6 +148,36 @@ func (_m *Provider) DeleteInstance(ctx context.Context, instance string, deleteI
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provider_DeleteInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteInstance'
|
||||||
|
type Provider_DeleteInstance_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteInstance is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - instance string
|
||||||
|
// - deleteInstanceParams common.DeleteInstanceParams
|
||||||
|
func (_e *Provider_Expecter) DeleteInstance(ctx interface{}, instance interface{}, deleteInstanceParams interface{}) *Provider_DeleteInstance_Call {
|
||||||
|
return &Provider_DeleteInstance_Call{Call: _e.mock.On("DeleteInstance", ctx, instance, deleteInstanceParams)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_DeleteInstance_Call) Run(run func(ctx context.Context, instance string, deleteInstanceParams common.DeleteInstanceParams)) *Provider_DeleteInstance_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(string), args[2].(common.DeleteInstanceParams))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_DeleteInstance_Call) Return(_a0 error) *Provider_DeleteInstance_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_DeleteInstance_Call) RunAndReturn(run func(context.Context, string, common.DeleteInstanceParams) error) *Provider_DeleteInstance_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// DisableJITConfig provides a mock function with no fields
|
// DisableJITConfig provides a mock function with no fields
|
||||||
func (_m *Provider) DisableJITConfig() bool {
|
func (_m *Provider) DisableJITConfig() bool {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -101,6 +196,33 @@ func (_m *Provider) DisableJITConfig() bool {
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provider_DisableJITConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisableJITConfig'
|
||||||
|
type Provider_DisableJITConfig_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// DisableJITConfig is a helper method to define mock.On call
|
||||||
|
func (_e *Provider_Expecter) DisableJITConfig() *Provider_DisableJITConfig_Call {
|
||||||
|
return &Provider_DisableJITConfig_Call{Call: _e.mock.On("DisableJITConfig")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_DisableJITConfig_Call) Run(run func()) *Provider_DisableJITConfig_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_DisableJITConfig_Call) Return(_a0 bool) *Provider_DisableJITConfig_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_DisableJITConfig_Call) RunAndReturn(run func() bool) *Provider_DisableJITConfig_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetInstance provides a mock function with given fields: ctx, instance, getInstanceParams
|
// GetInstance provides a mock function with given fields: ctx, instance, getInstanceParams
|
||||||
func (_m *Provider) GetInstance(ctx context.Context, instance string, getInstanceParams common.GetInstanceParams) (garm_provider_commonparams.ProviderInstance, error) {
|
func (_m *Provider) GetInstance(ctx context.Context, instance string, getInstanceParams common.GetInstanceParams) (garm_provider_commonparams.ProviderInstance, error) {
|
||||||
ret := _m.Called(ctx, instance, getInstanceParams)
|
ret := _m.Called(ctx, instance, getInstanceParams)
|
||||||
|
|
@ -129,6 +251,36 @@ func (_m *Provider) GetInstance(ctx context.Context, instance string, getInstanc
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provider_GetInstance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInstance'
|
||||||
|
type Provider_GetInstance_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetInstance is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - instance string
|
||||||
|
// - getInstanceParams common.GetInstanceParams
|
||||||
|
func (_e *Provider_Expecter) GetInstance(ctx interface{}, instance interface{}, getInstanceParams interface{}) *Provider_GetInstance_Call {
|
||||||
|
return &Provider_GetInstance_Call{Call: _e.mock.On("GetInstance", ctx, instance, getInstanceParams)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_GetInstance_Call) Run(run func(ctx context.Context, instance string, getInstanceParams common.GetInstanceParams)) *Provider_GetInstance_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(string), args[2].(common.GetInstanceParams))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_GetInstance_Call) Return(_a0 garm_provider_commonparams.ProviderInstance, _a1 error) *Provider_GetInstance_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_GetInstance_Call) RunAndReturn(run func(context.Context, string, common.GetInstanceParams) (garm_provider_commonparams.ProviderInstance, error)) *Provider_GetInstance_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListInstances provides a mock function with given fields: ctx, poolID, listInstancesParams
|
// ListInstances provides a mock function with given fields: ctx, poolID, listInstancesParams
|
||||||
func (_m *Provider) ListInstances(ctx context.Context, poolID string, listInstancesParams common.ListInstancesParams) ([]garm_provider_commonparams.ProviderInstance, error) {
|
func (_m *Provider) ListInstances(ctx context.Context, poolID string, listInstancesParams common.ListInstancesParams) ([]garm_provider_commonparams.ProviderInstance, error) {
|
||||||
ret := _m.Called(ctx, poolID, listInstancesParams)
|
ret := _m.Called(ctx, poolID, listInstancesParams)
|
||||||
|
|
@ -159,6 +311,36 @@ func (_m *Provider) ListInstances(ctx context.Context, poolID string, listInstan
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provider_ListInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListInstances'
|
||||||
|
type Provider_ListInstances_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListInstances is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - poolID string
|
||||||
|
// - listInstancesParams common.ListInstancesParams
|
||||||
|
func (_e *Provider_Expecter) ListInstances(ctx interface{}, poolID interface{}, listInstancesParams interface{}) *Provider_ListInstances_Call {
|
||||||
|
return &Provider_ListInstances_Call{Call: _e.mock.On("ListInstances", ctx, poolID, listInstancesParams)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_ListInstances_Call) Run(run func(ctx context.Context, poolID string, listInstancesParams common.ListInstancesParams)) *Provider_ListInstances_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(string), args[2].(common.ListInstancesParams))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_ListInstances_Call) Return(_a0 []garm_provider_commonparams.ProviderInstance, _a1 error) *Provider_ListInstances_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_ListInstances_Call) RunAndReturn(run func(context.Context, string, common.ListInstancesParams) ([]garm_provider_commonparams.ProviderInstance, error)) *Provider_ListInstances_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RemoveAllInstances provides a mock function with given fields: ctx, removeAllInstancesParams
|
// RemoveAllInstances provides a mock function with given fields: ctx, removeAllInstancesParams
|
||||||
func (_m *Provider) RemoveAllInstances(ctx context.Context, removeAllInstancesParams common.RemoveAllInstancesParams) error {
|
func (_m *Provider) RemoveAllInstances(ctx context.Context, removeAllInstancesParams common.RemoveAllInstancesParams) error {
|
||||||
ret := _m.Called(ctx, removeAllInstancesParams)
|
ret := _m.Called(ctx, removeAllInstancesParams)
|
||||||
|
|
@ -177,6 +359,35 @@ func (_m *Provider) RemoveAllInstances(ctx context.Context, removeAllInstancesPa
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provider_RemoveAllInstances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveAllInstances'
|
||||||
|
type Provider_RemoveAllInstances_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveAllInstances is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - removeAllInstancesParams common.RemoveAllInstancesParams
|
||||||
|
func (_e *Provider_Expecter) RemoveAllInstances(ctx interface{}, removeAllInstancesParams interface{}) *Provider_RemoveAllInstances_Call {
|
||||||
|
return &Provider_RemoveAllInstances_Call{Call: _e.mock.On("RemoveAllInstances", ctx, removeAllInstancesParams)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_RemoveAllInstances_Call) Run(run func(ctx context.Context, removeAllInstancesParams common.RemoveAllInstancesParams)) *Provider_RemoveAllInstances_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(common.RemoveAllInstancesParams))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_RemoveAllInstances_Call) Return(_a0 error) *Provider_RemoveAllInstances_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_RemoveAllInstances_Call) RunAndReturn(run func(context.Context, common.RemoveAllInstancesParams) error) *Provider_RemoveAllInstances_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// Start provides a mock function with given fields: ctx, instance, startParams
|
// Start provides a mock function with given fields: ctx, instance, startParams
|
||||||
func (_m *Provider) Start(ctx context.Context, instance string, startParams common.StartParams) error {
|
func (_m *Provider) Start(ctx context.Context, instance string, startParams common.StartParams) error {
|
||||||
ret := _m.Called(ctx, instance, startParams)
|
ret := _m.Called(ctx, instance, startParams)
|
||||||
|
|
@ -195,6 +406,36 @@ func (_m *Provider) Start(ctx context.Context, instance string, startParams comm
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provider_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
||||||
|
type Provider_Start_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - instance string
|
||||||
|
// - startParams common.StartParams
|
||||||
|
func (_e *Provider_Expecter) Start(ctx interface{}, instance interface{}, startParams interface{}) *Provider_Start_Call {
|
||||||
|
return &Provider_Start_Call{Call: _e.mock.On("Start", ctx, instance, startParams)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_Start_Call) Run(run func(ctx context.Context, instance string, startParams common.StartParams)) *Provider_Start_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(string), args[2].(common.StartParams))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_Start_Call) Return(_a0 error) *Provider_Start_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_Start_Call) RunAndReturn(run func(context.Context, string, common.StartParams) error) *Provider_Start_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// Stop provides a mock function with given fields: ctx, instance, stopParams
|
// Stop provides a mock function with given fields: ctx, instance, stopParams
|
||||||
func (_m *Provider) Stop(ctx context.Context, instance string, stopParams common.StopParams) error {
|
func (_m *Provider) Stop(ctx context.Context, instance string, stopParams common.StopParams) error {
|
||||||
ret := _m.Called(ctx, instance, stopParams)
|
ret := _m.Called(ctx, instance, stopParams)
|
||||||
|
|
@ -213,6 +454,36 @@ func (_m *Provider) Stop(ctx context.Context, instance string, stopParams common
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provider_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
|
||||||
|
type Provider_Stop_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - instance string
|
||||||
|
// - stopParams common.StopParams
|
||||||
|
func (_e *Provider_Expecter) Stop(ctx interface{}, instance interface{}, stopParams interface{}) *Provider_Stop_Call {
|
||||||
|
return &Provider_Stop_Call{Call: _e.mock.On("Stop", ctx, instance, stopParams)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_Stop_Call) Run(run func(ctx context.Context, instance string, stopParams common.StopParams)) *Provider_Stop_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(string), args[2].(common.StopParams))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_Stop_Call) Return(_a0 error) *Provider_Stop_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *Provider_Stop_Call) RunAndReturn(run func(context.Context, string, common.StopParams) error) *Provider_Stop_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// NewProvider creates a new instance of Provider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
// NewProvider creates a new instance of Provider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||||
// The first argument is typically a *testing.T value.
|
// The first argument is typically a *testing.T value.
|
||||||
func NewProvider(t interface {
|
func NewProvider(t interface {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
// Code generated by mockery. DO NOT EDIT.
|
||||||
|
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
|
|
@ -14,6 +14,14 @@ type RateLimitClient struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RateLimitClient_Expecter struct {
|
||||||
|
mock *mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_m *RateLimitClient) EXPECT() *RateLimitClient_Expecter {
|
||||||
|
return &RateLimitClient_Expecter{mock: &_m.Mock}
|
||||||
|
}
|
||||||
|
|
||||||
// RateLimit provides a mock function with given fields: ctx
|
// RateLimit provides a mock function with given fields: ctx
|
||||||
func (_m *RateLimitClient) RateLimit(ctx context.Context) (*github.RateLimits, error) {
|
func (_m *RateLimitClient) RateLimit(ctx context.Context) (*github.RateLimits, error) {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
|
|
@ -44,6 +52,34 @@ func (_m *RateLimitClient) RateLimit(ctx context.Context) (*github.RateLimits, e
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RateLimitClient_RateLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RateLimit'
|
||||||
|
type RateLimitClient_RateLimit_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RateLimit is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *RateLimitClient_Expecter) RateLimit(ctx interface{}) *RateLimitClient_RateLimit_Call {
|
||||||
|
return &RateLimitClient_RateLimit_Call{Call: _e.mock.On("RateLimit", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RateLimitClient_RateLimit_Call) Run(run func(ctx context.Context)) *RateLimitClient_RateLimit_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RateLimitClient_RateLimit_Call) Return(_a0 *github.RateLimits, _a1 error) *RateLimitClient_RateLimit_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RateLimitClient_RateLimit_Call) RunAndReturn(run func(context.Context) (*github.RateLimits, error)) *RateLimitClient_RateLimit_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// NewRateLimitClient creates a new instance of RateLimitClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
// NewRateLimitClient creates a new instance of RateLimitClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||||
// The first argument is typically a *testing.T value.
|
// The first argument is typically a *testing.T value.
|
||||||
func NewRateLimitClient(t interface {
|
func NewRateLimitClient(t interface {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ const (
|
||||||
BackoffTimer = 1 * time.Minute
|
BackoffTimer = 1 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate mockery --all
|
//go:generate go run github.com/vektra/mockery/v2@latest
|
||||||
type PoolManager interface {
|
type PoolManager interface {
|
||||||
// ID returns the ID of the entity (repo, org, enterprise)
|
// ID returns the ID of the entity (repo, org, enterprise)
|
||||||
ID() string
|
ID() string
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import (
|
||||||
"github.com/cloudbase/garm/params"
|
"github.com/cloudbase/garm/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate mockery --all
|
//go:generate go run github.com/vektra/mockery/v2@latest
|
||||||
type Provider interface {
|
type Provider interface {
|
||||||
// CreateInstance creates a new compute instance in the provider.
|
// CreateInstance creates a new compute instance in the provider.
|
||||||
CreateInstance(ctx context.Context, bootstrapParams commonParams.BootstrapInstance, createInstanceParams CreateInstanceParams) (commonParams.ProviderInstance, error)
|
CreateInstance(ctx context.Context, bootstrapParams commonParams.BootstrapInstance, createInstanceParams CreateInstanceParams) (commonParams.ProviderInstance, error)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ type RateLimitClient interface {
|
||||||
// GithubClient that describes the minimum list of functions we need to interact with github.
|
// GithubClient that describes the minimum list of functions we need to interact with github.
|
||||||
// Allows for easier testing.
|
// Allows for easier testing.
|
||||||
//
|
//
|
||||||
//go:generate mockery --all
|
//go:generate go run github.com/vektra/mockery/v2@latest
|
||||||
type GithubClient interface {
|
type GithubClient interface {
|
||||||
GithubEntityOperations
|
GithubEntityOperations
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ type EnterprisePoolManager interface {
|
||||||
GetEnterprisePoolManagers() (map[string]common.PoolManager, error)
|
GetEnterprisePoolManagers() (map[string]common.PoolManager, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:generate mockery --name=PoolManagerController
|
//go:generate go run github.com/vektra/mockery/v2@latest
|
||||||
|
|
||||||
type PoolManagerController interface {
|
type PoolManagerController interface {
|
||||||
RepoPoolManager
|
RepoPoolManager
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
// Code generated by mockery. DO NOT EDIT.
|
||||||
|
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
|
|
@ -19,6 +19,14 @@ type PoolManagerController struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PoolManagerController_Expecter struct {
|
||||||
|
mock *mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_m *PoolManagerController) EXPECT() *PoolManagerController_Expecter {
|
||||||
|
return &PoolManagerController_Expecter{mock: &_m.Mock}
|
||||||
|
}
|
||||||
|
|
||||||
// CreateEnterprisePoolManager provides a mock function with given fields: ctx, enterprise, providers, store
|
// CreateEnterprisePoolManager provides a mock function with given fields: ctx, enterprise, providers, store
|
||||||
func (_m *PoolManagerController) CreateEnterprisePoolManager(ctx context.Context, enterprise params.Enterprise, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) {
|
func (_m *PoolManagerController) CreateEnterprisePoolManager(ctx context.Context, enterprise params.Enterprise, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) {
|
||||||
ret := _m.Called(ctx, enterprise, providers, store)
|
ret := _m.Called(ctx, enterprise, providers, store)
|
||||||
|
|
@ -49,6 +57,37 @@ func (_m *PoolManagerController) CreateEnterprisePoolManager(ctx context.Context
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_CreateEnterprisePoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEnterprisePoolManager'
|
||||||
|
type PoolManagerController_CreateEnterprisePoolManager_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateEnterprisePoolManager is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - enterprise params.Enterprise
|
||||||
|
// - providers map[string]common.Provider
|
||||||
|
// - store databasecommon.Store
|
||||||
|
func (_e *PoolManagerController_Expecter) CreateEnterprisePoolManager(ctx interface{}, enterprise interface{}, providers interface{}, store interface{}) *PoolManagerController_CreateEnterprisePoolManager_Call {
|
||||||
|
return &PoolManagerController_CreateEnterprisePoolManager_Call{Call: _e.mock.On("CreateEnterprisePoolManager", ctx, enterprise, providers, store)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_CreateEnterprisePoolManager_Call) Run(run func(ctx context.Context, enterprise params.Enterprise, providers map[string]common.Provider, store databasecommon.Store)) *PoolManagerController_CreateEnterprisePoolManager_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(params.Enterprise), args[2].(map[string]common.Provider), args[3].(databasecommon.Store))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_CreateEnterprisePoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_CreateEnterprisePoolManager_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_CreateEnterprisePoolManager_Call) RunAndReturn(run func(context.Context, params.Enterprise, map[string]common.Provider, databasecommon.Store) (common.PoolManager, error)) *PoolManagerController_CreateEnterprisePoolManager_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// CreateOrgPoolManager provides a mock function with given fields: ctx, org, providers, store
|
// CreateOrgPoolManager provides a mock function with given fields: ctx, org, providers, store
|
||||||
func (_m *PoolManagerController) CreateOrgPoolManager(ctx context.Context, org params.Organization, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) {
|
func (_m *PoolManagerController) CreateOrgPoolManager(ctx context.Context, org params.Organization, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) {
|
||||||
ret := _m.Called(ctx, org, providers, store)
|
ret := _m.Called(ctx, org, providers, store)
|
||||||
|
|
@ -79,6 +118,37 @@ func (_m *PoolManagerController) CreateOrgPoolManager(ctx context.Context, org p
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_CreateOrgPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateOrgPoolManager'
|
||||||
|
type PoolManagerController_CreateOrgPoolManager_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrgPoolManager is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - org params.Organization
|
||||||
|
// - providers map[string]common.Provider
|
||||||
|
// - store databasecommon.Store
|
||||||
|
func (_e *PoolManagerController_Expecter) CreateOrgPoolManager(ctx interface{}, org interface{}, providers interface{}, store interface{}) *PoolManagerController_CreateOrgPoolManager_Call {
|
||||||
|
return &PoolManagerController_CreateOrgPoolManager_Call{Call: _e.mock.On("CreateOrgPoolManager", ctx, org, providers, store)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_CreateOrgPoolManager_Call) Run(run func(ctx context.Context, org params.Organization, providers map[string]common.Provider, store databasecommon.Store)) *PoolManagerController_CreateOrgPoolManager_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(params.Organization), args[2].(map[string]common.Provider), args[3].(databasecommon.Store))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_CreateOrgPoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_CreateOrgPoolManager_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_CreateOrgPoolManager_Call) RunAndReturn(run func(context.Context, params.Organization, map[string]common.Provider, databasecommon.Store) (common.PoolManager, error)) *PoolManagerController_CreateOrgPoolManager_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// CreateRepoPoolManager provides a mock function with given fields: ctx, repo, providers, store
|
// CreateRepoPoolManager provides a mock function with given fields: ctx, repo, providers, store
|
||||||
func (_m *PoolManagerController) CreateRepoPoolManager(ctx context.Context, repo params.Repository, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) {
|
func (_m *PoolManagerController) CreateRepoPoolManager(ctx context.Context, repo params.Repository, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) {
|
||||||
ret := _m.Called(ctx, repo, providers, store)
|
ret := _m.Called(ctx, repo, providers, store)
|
||||||
|
|
@ -109,6 +179,37 @@ func (_m *PoolManagerController) CreateRepoPoolManager(ctx context.Context, repo
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_CreateRepoPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRepoPoolManager'
|
||||||
|
type PoolManagerController_CreateRepoPoolManager_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateRepoPoolManager is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - repo params.Repository
|
||||||
|
// - providers map[string]common.Provider
|
||||||
|
// - store databasecommon.Store
|
||||||
|
func (_e *PoolManagerController_Expecter) CreateRepoPoolManager(ctx interface{}, repo interface{}, providers interface{}, store interface{}) *PoolManagerController_CreateRepoPoolManager_Call {
|
||||||
|
return &PoolManagerController_CreateRepoPoolManager_Call{Call: _e.mock.On("CreateRepoPoolManager", ctx, repo, providers, store)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_CreateRepoPoolManager_Call) Run(run func(ctx context.Context, repo params.Repository, providers map[string]common.Provider, store databasecommon.Store)) *PoolManagerController_CreateRepoPoolManager_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(params.Repository), args[2].(map[string]common.Provider), args[3].(databasecommon.Store))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_CreateRepoPoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_CreateRepoPoolManager_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_CreateRepoPoolManager_Call) RunAndReturn(run func(context.Context, params.Repository, map[string]common.Provider, databasecommon.Store) (common.PoolManager, error)) *PoolManagerController_CreateRepoPoolManager_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// DeleteEnterprisePoolManager provides a mock function with given fields: enterprise
|
// DeleteEnterprisePoolManager provides a mock function with given fields: enterprise
|
||||||
func (_m *PoolManagerController) DeleteEnterprisePoolManager(enterprise params.Enterprise) error {
|
func (_m *PoolManagerController) DeleteEnterprisePoolManager(enterprise params.Enterprise) error {
|
||||||
ret := _m.Called(enterprise)
|
ret := _m.Called(enterprise)
|
||||||
|
|
@ -127,6 +228,34 @@ func (_m *PoolManagerController) DeleteEnterprisePoolManager(enterprise params.E
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_DeleteEnterprisePoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEnterprisePoolManager'
|
||||||
|
type PoolManagerController_DeleteEnterprisePoolManager_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteEnterprisePoolManager is a helper method to define mock.On call
|
||||||
|
// - enterprise params.Enterprise
|
||||||
|
func (_e *PoolManagerController_Expecter) DeleteEnterprisePoolManager(enterprise interface{}) *PoolManagerController_DeleteEnterprisePoolManager_Call {
|
||||||
|
return &PoolManagerController_DeleteEnterprisePoolManager_Call{Call: _e.mock.On("DeleteEnterprisePoolManager", enterprise)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_DeleteEnterprisePoolManager_Call) Run(run func(enterprise params.Enterprise)) *PoolManagerController_DeleteEnterprisePoolManager_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(params.Enterprise))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_DeleteEnterprisePoolManager_Call) Return(_a0 error) *PoolManagerController_DeleteEnterprisePoolManager_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_DeleteEnterprisePoolManager_Call) RunAndReturn(run func(params.Enterprise) error) *PoolManagerController_DeleteEnterprisePoolManager_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// DeleteOrgPoolManager provides a mock function with given fields: org
|
// DeleteOrgPoolManager provides a mock function with given fields: org
|
||||||
func (_m *PoolManagerController) DeleteOrgPoolManager(org params.Organization) error {
|
func (_m *PoolManagerController) DeleteOrgPoolManager(org params.Organization) error {
|
||||||
ret := _m.Called(org)
|
ret := _m.Called(org)
|
||||||
|
|
@ -145,6 +274,34 @@ func (_m *PoolManagerController) DeleteOrgPoolManager(org params.Organization) e
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_DeleteOrgPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteOrgPoolManager'
|
||||||
|
type PoolManagerController_DeleteOrgPoolManager_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrgPoolManager is a helper method to define mock.On call
|
||||||
|
// - org params.Organization
|
||||||
|
func (_e *PoolManagerController_Expecter) DeleteOrgPoolManager(org interface{}) *PoolManagerController_DeleteOrgPoolManager_Call {
|
||||||
|
return &PoolManagerController_DeleteOrgPoolManager_Call{Call: _e.mock.On("DeleteOrgPoolManager", org)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_DeleteOrgPoolManager_Call) Run(run func(org params.Organization)) *PoolManagerController_DeleteOrgPoolManager_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(params.Organization))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_DeleteOrgPoolManager_Call) Return(_a0 error) *PoolManagerController_DeleteOrgPoolManager_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_DeleteOrgPoolManager_Call) RunAndReturn(run func(params.Organization) error) *PoolManagerController_DeleteOrgPoolManager_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// DeleteRepoPoolManager provides a mock function with given fields: repo
|
// DeleteRepoPoolManager provides a mock function with given fields: repo
|
||||||
func (_m *PoolManagerController) DeleteRepoPoolManager(repo params.Repository) error {
|
func (_m *PoolManagerController) DeleteRepoPoolManager(repo params.Repository) error {
|
||||||
ret := _m.Called(repo)
|
ret := _m.Called(repo)
|
||||||
|
|
@ -163,6 +320,34 @@ func (_m *PoolManagerController) DeleteRepoPoolManager(repo params.Repository) e
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_DeleteRepoPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteRepoPoolManager'
|
||||||
|
type PoolManagerController_DeleteRepoPoolManager_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteRepoPoolManager is a helper method to define mock.On call
|
||||||
|
// - repo params.Repository
|
||||||
|
func (_e *PoolManagerController_Expecter) DeleteRepoPoolManager(repo interface{}) *PoolManagerController_DeleteRepoPoolManager_Call {
|
||||||
|
return &PoolManagerController_DeleteRepoPoolManager_Call{Call: _e.mock.On("DeleteRepoPoolManager", repo)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_DeleteRepoPoolManager_Call) Run(run func(repo params.Repository)) *PoolManagerController_DeleteRepoPoolManager_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(params.Repository))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_DeleteRepoPoolManager_Call) Return(_a0 error) *PoolManagerController_DeleteRepoPoolManager_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_DeleteRepoPoolManager_Call) RunAndReturn(run func(params.Repository) error) *PoolManagerController_DeleteRepoPoolManager_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetEnterprisePoolManager provides a mock function with given fields: enterprise
|
// GetEnterprisePoolManager provides a mock function with given fields: enterprise
|
||||||
func (_m *PoolManagerController) GetEnterprisePoolManager(enterprise params.Enterprise) (common.PoolManager, error) {
|
func (_m *PoolManagerController) GetEnterprisePoolManager(enterprise params.Enterprise) (common.PoolManager, error) {
|
||||||
ret := _m.Called(enterprise)
|
ret := _m.Called(enterprise)
|
||||||
|
|
@ -193,6 +378,34 @@ func (_m *PoolManagerController) GetEnterprisePoolManager(enterprise params.Ente
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_GetEnterprisePoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEnterprisePoolManager'
|
||||||
|
type PoolManagerController_GetEnterprisePoolManager_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEnterprisePoolManager is a helper method to define mock.On call
|
||||||
|
// - enterprise params.Enterprise
|
||||||
|
func (_e *PoolManagerController_Expecter) GetEnterprisePoolManager(enterprise interface{}) *PoolManagerController_GetEnterprisePoolManager_Call {
|
||||||
|
return &PoolManagerController_GetEnterprisePoolManager_Call{Call: _e.mock.On("GetEnterprisePoolManager", enterprise)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetEnterprisePoolManager_Call) Run(run func(enterprise params.Enterprise)) *PoolManagerController_GetEnterprisePoolManager_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(params.Enterprise))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetEnterprisePoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_GetEnterprisePoolManager_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetEnterprisePoolManager_Call) RunAndReturn(run func(params.Enterprise) (common.PoolManager, error)) *PoolManagerController_GetEnterprisePoolManager_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetEnterprisePoolManagers provides a mock function with no fields
|
// GetEnterprisePoolManagers provides a mock function with no fields
|
||||||
func (_m *PoolManagerController) GetEnterprisePoolManagers() (map[string]common.PoolManager, error) {
|
func (_m *PoolManagerController) GetEnterprisePoolManagers() (map[string]common.PoolManager, error) {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -223,6 +436,33 @@ func (_m *PoolManagerController) GetEnterprisePoolManagers() (map[string]common.
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_GetEnterprisePoolManagers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEnterprisePoolManagers'
|
||||||
|
type PoolManagerController_GetEnterprisePoolManagers_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetEnterprisePoolManagers is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManagerController_Expecter) GetEnterprisePoolManagers() *PoolManagerController_GetEnterprisePoolManagers_Call {
|
||||||
|
return &PoolManagerController_GetEnterprisePoolManagers_Call{Call: _e.mock.On("GetEnterprisePoolManagers")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetEnterprisePoolManagers_Call) Run(run func()) *PoolManagerController_GetEnterprisePoolManagers_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetEnterprisePoolManagers_Call) Return(_a0 map[string]common.PoolManager, _a1 error) *PoolManagerController_GetEnterprisePoolManagers_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetEnterprisePoolManagers_Call) RunAndReturn(run func() (map[string]common.PoolManager, error)) *PoolManagerController_GetEnterprisePoolManagers_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetOrgPoolManager provides a mock function with given fields: org
|
// GetOrgPoolManager provides a mock function with given fields: org
|
||||||
func (_m *PoolManagerController) GetOrgPoolManager(org params.Organization) (common.PoolManager, error) {
|
func (_m *PoolManagerController) GetOrgPoolManager(org params.Organization) (common.PoolManager, error) {
|
||||||
ret := _m.Called(org)
|
ret := _m.Called(org)
|
||||||
|
|
@ -253,6 +493,34 @@ func (_m *PoolManagerController) GetOrgPoolManager(org params.Organization) (com
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_GetOrgPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOrgPoolManager'
|
||||||
|
type PoolManagerController_GetOrgPoolManager_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrgPoolManager is a helper method to define mock.On call
|
||||||
|
// - org params.Organization
|
||||||
|
func (_e *PoolManagerController_Expecter) GetOrgPoolManager(org interface{}) *PoolManagerController_GetOrgPoolManager_Call {
|
||||||
|
return &PoolManagerController_GetOrgPoolManager_Call{Call: _e.mock.On("GetOrgPoolManager", org)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetOrgPoolManager_Call) Run(run func(org params.Organization)) *PoolManagerController_GetOrgPoolManager_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(params.Organization))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetOrgPoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_GetOrgPoolManager_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetOrgPoolManager_Call) RunAndReturn(run func(params.Organization) (common.PoolManager, error)) *PoolManagerController_GetOrgPoolManager_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetOrgPoolManagers provides a mock function with no fields
|
// GetOrgPoolManagers provides a mock function with no fields
|
||||||
func (_m *PoolManagerController) GetOrgPoolManagers() (map[string]common.PoolManager, error) {
|
func (_m *PoolManagerController) GetOrgPoolManagers() (map[string]common.PoolManager, error) {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -283,6 +551,33 @@ func (_m *PoolManagerController) GetOrgPoolManagers() (map[string]common.PoolMan
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_GetOrgPoolManagers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOrgPoolManagers'
|
||||||
|
type PoolManagerController_GetOrgPoolManagers_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrgPoolManagers is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManagerController_Expecter) GetOrgPoolManagers() *PoolManagerController_GetOrgPoolManagers_Call {
|
||||||
|
return &PoolManagerController_GetOrgPoolManagers_Call{Call: _e.mock.On("GetOrgPoolManagers")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetOrgPoolManagers_Call) Run(run func()) *PoolManagerController_GetOrgPoolManagers_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetOrgPoolManagers_Call) Return(_a0 map[string]common.PoolManager, _a1 error) *PoolManagerController_GetOrgPoolManagers_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetOrgPoolManagers_Call) RunAndReturn(run func() (map[string]common.PoolManager, error)) *PoolManagerController_GetOrgPoolManagers_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetRepoPoolManager provides a mock function with given fields: repo
|
// GetRepoPoolManager provides a mock function with given fields: repo
|
||||||
func (_m *PoolManagerController) GetRepoPoolManager(repo params.Repository) (common.PoolManager, error) {
|
func (_m *PoolManagerController) GetRepoPoolManager(repo params.Repository) (common.PoolManager, error) {
|
||||||
ret := _m.Called(repo)
|
ret := _m.Called(repo)
|
||||||
|
|
@ -313,6 +608,34 @@ func (_m *PoolManagerController) GetRepoPoolManager(repo params.Repository) (com
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_GetRepoPoolManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRepoPoolManager'
|
||||||
|
type PoolManagerController_GetRepoPoolManager_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRepoPoolManager is a helper method to define mock.On call
|
||||||
|
// - repo params.Repository
|
||||||
|
func (_e *PoolManagerController_Expecter) GetRepoPoolManager(repo interface{}) *PoolManagerController_GetRepoPoolManager_Call {
|
||||||
|
return &PoolManagerController_GetRepoPoolManager_Call{Call: _e.mock.On("GetRepoPoolManager", repo)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetRepoPoolManager_Call) Run(run func(repo params.Repository)) *PoolManagerController_GetRepoPoolManager_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(params.Repository))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetRepoPoolManager_Call) Return(_a0 common.PoolManager, _a1 error) *PoolManagerController_GetRepoPoolManager_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetRepoPoolManager_Call) RunAndReturn(run func(params.Repository) (common.PoolManager, error)) *PoolManagerController_GetRepoPoolManager_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// GetRepoPoolManagers provides a mock function with no fields
|
// GetRepoPoolManagers provides a mock function with no fields
|
||||||
func (_m *PoolManagerController) GetRepoPoolManagers() (map[string]common.PoolManager, error) {
|
func (_m *PoolManagerController) GetRepoPoolManagers() (map[string]common.PoolManager, error) {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
@ -343,6 +666,33 @@ func (_m *PoolManagerController) GetRepoPoolManagers() (map[string]common.PoolMa
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PoolManagerController_GetRepoPoolManagers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRepoPoolManagers'
|
||||||
|
type PoolManagerController_GetRepoPoolManagers_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRepoPoolManagers is a helper method to define mock.On call
|
||||||
|
func (_e *PoolManagerController_Expecter) GetRepoPoolManagers() *PoolManagerController_GetRepoPoolManagers_Call {
|
||||||
|
return &PoolManagerController_GetRepoPoolManagers_Call{Call: _e.mock.On("GetRepoPoolManagers")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetRepoPoolManagers_Call) Run(run func()) *PoolManagerController_GetRepoPoolManagers_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetRepoPoolManagers_Call) Return(_a0 map[string]common.PoolManager, _a1 error) *PoolManagerController_GetRepoPoolManagers_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *PoolManagerController_GetRepoPoolManagers_Call) RunAndReturn(run func() (map[string]common.PoolManager, error)) *PoolManagerController_GetRepoPoolManagers_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// NewPoolManagerController creates a new instance of PoolManagerController. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
// NewPoolManagerController creates a new instance of PoolManagerController. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||||
// The first argument is typically a *testing.T value.
|
// The first argument is typically a *testing.T value.
|
||||||
func NewPoolManagerController(t interface {
|
func NewPoolManagerController(t interface {
|
||||||
|
|
|
||||||
2
testdata/config.toml
vendored
2
testdata/config.toml
vendored
|
|
@ -82,6 +82,8 @@ time_to_live = "8760h"
|
||||||
certificate = ""
|
certificate = ""
|
||||||
# The path on disk to the corresponding private key for the certificate.
|
# The path on disk to the corresponding private key for the certificate.
|
||||||
key = ""
|
key = ""
|
||||||
|
[apiserver.webui]
|
||||||
|
enable = true
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
# Turn on/off debugging for database queries.
|
# Turn on/off debugging for database queries.
|
||||||
|
|
|
||||||
68
util/util.go
68
util/util.go
|
|
@ -17,6 +17,7 @@ package util
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
|
|
@ -43,3 +44,70 @@ func FetchTools(ctx context.Context, cli common.GithubClient) ([]commonParams.Ru
|
||||||
}
|
}
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ASCIIEqualFold(s, t string) bool {
|
||||||
|
// Fast ASCII path for equal-length ASCII strings
|
||||||
|
if len(s) == len(t) && isASCII(s) && isASCII(t) {
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
a, b := s[i], t[i]
|
||||||
|
if a != b {
|
||||||
|
if 'A' <= a && a <= 'Z' {
|
||||||
|
a = a + 'a' - 'A'
|
||||||
|
}
|
||||||
|
if 'A' <= b && b <= 'Z' {
|
||||||
|
b = b + 'a' - 'A'
|
||||||
|
}
|
||||||
|
if a != b {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// UTF-8 path - handle different byte lengths correctly
|
||||||
|
i, j := 0, 0
|
||||||
|
for i < len(s) && j < len(t) {
|
||||||
|
sr, sizeS := utf8.DecodeRuneInString(s[i:])
|
||||||
|
tr, sizeT := utf8.DecodeRuneInString(t[j:])
|
||||||
|
|
||||||
|
// Handle invalid UTF-8 - they must be identical
|
||||||
|
if sr == utf8.RuneError || tr == utf8.RuneError {
|
||||||
|
// For invalid UTF-8, compare the raw bytes
|
||||||
|
if sr == utf8.RuneError && tr == utf8.RuneError {
|
||||||
|
if sizeS == sizeT && s[i:i+sizeS] == t[j:j+sizeT] {
|
||||||
|
i += sizeS
|
||||||
|
j += sizeT
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if sr != tr {
|
||||||
|
// Apply ASCII case folding only
|
||||||
|
if 'A' <= sr && sr <= 'Z' {
|
||||||
|
sr = sr + 'a' - 'A'
|
||||||
|
}
|
||||||
|
if 'A' <= tr && tr <= 'Z' {
|
||||||
|
tr = tr + 'a' - 'A'
|
||||||
|
}
|
||||||
|
if sr != tr {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i += sizeS
|
||||||
|
j += sizeT
|
||||||
|
}
|
||||||
|
return i == len(s) && j == len(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
func isASCII(s string) bool {
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
if s[i] >= 0x80 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
|
||||||
394
util/util_test.go
Normal file
394
util/util_test.go
Normal file
|
|
@ -0,0 +1,394 @@
|
||||||
|
// Copyright 2022 Cloudbase Solutions SRL
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
// not use this file except in compliance with the License. You may obtain
|
||||||
|
// a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
// License for the specific language governing permissions and limitations
|
||||||
|
// under the License.
|
||||||
|
|
||||||
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestASCIIEqualFold(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
s string
|
||||||
|
t string
|
||||||
|
expected bool
|
||||||
|
reason string
|
||||||
|
}{
|
||||||
|
// Basic ASCII case folding tests
|
||||||
|
{
|
||||||
|
name: "identical strings",
|
||||||
|
s: "hello",
|
||||||
|
t: "hello",
|
||||||
|
expected: true,
|
||||||
|
reason: "identical strings should match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "simple case difference",
|
||||||
|
s: "Hello",
|
||||||
|
t: "hello",
|
||||||
|
expected: true,
|
||||||
|
reason: "ASCII case folding should match H/h",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "all uppercase vs lowercase",
|
||||||
|
s: "HELLO",
|
||||||
|
t: "hello",
|
||||||
|
expected: true,
|
||||||
|
reason: "ASCII case folding should match all cases",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "mixed case",
|
||||||
|
s: "HeLLo",
|
||||||
|
t: "hEllO",
|
||||||
|
expected: true,
|
||||||
|
reason: "mixed case should match after folding",
|
||||||
|
},
|
||||||
|
|
||||||
|
// Empty string tests
|
||||||
|
{
|
||||||
|
name: "both empty",
|
||||||
|
s: "",
|
||||||
|
t: "",
|
||||||
|
expected: true,
|
||||||
|
reason: "empty strings should match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "one empty",
|
||||||
|
s: "hello",
|
||||||
|
t: "",
|
||||||
|
expected: false,
|
||||||
|
reason: "different length strings should not match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "other empty",
|
||||||
|
s: "",
|
||||||
|
t: "hello",
|
||||||
|
expected: false,
|
||||||
|
reason: "different length strings should not match",
|
||||||
|
},
|
||||||
|
|
||||||
|
// Different content tests
|
||||||
|
{
|
||||||
|
name: "different strings same case",
|
||||||
|
s: "hello",
|
||||||
|
t: "world",
|
||||||
|
expected: false,
|
||||||
|
reason: "different content should not match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "different strings different case",
|
||||||
|
s: "Hello",
|
||||||
|
t: "World",
|
||||||
|
expected: false,
|
||||||
|
reason: "different content should not match regardless of case",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "different length",
|
||||||
|
s: "hello",
|
||||||
|
t: "hello world",
|
||||||
|
expected: false,
|
||||||
|
reason: "different length strings should not match",
|
||||||
|
},
|
||||||
|
|
||||||
|
// ASCII non-alphabetic characters
|
||||||
|
{
|
||||||
|
name: "numbers and symbols",
|
||||||
|
s: "Hello123!@#",
|
||||||
|
t: "hello123!@#",
|
||||||
|
expected: true,
|
||||||
|
reason: "numbers and symbols should be preserved, only letters folded",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "different numbers",
|
||||||
|
s: "Hello123",
|
||||||
|
t: "Hello124",
|
||||||
|
expected: false,
|
||||||
|
reason: "different numbers should not match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "different symbols",
|
||||||
|
s: "Hello!",
|
||||||
|
t: "Hello?",
|
||||||
|
expected: false,
|
||||||
|
reason: "different symbols should not match",
|
||||||
|
},
|
||||||
|
|
||||||
|
// URL-specific tests (CORS security focus)
|
||||||
|
{
|
||||||
|
name: "HTTP scheme case",
|
||||||
|
s: "HTTP://example.com",
|
||||||
|
t: "http://example.com",
|
||||||
|
expected: true,
|
||||||
|
reason: "HTTP scheme should be case-insensitive",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "HTTPS scheme case",
|
||||||
|
s: "HTTPS://EXAMPLE.COM",
|
||||||
|
t: "https://example.com",
|
||||||
|
expected: true,
|
||||||
|
reason: "HTTPS scheme and domain should be case-insensitive",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "complex URL case",
|
||||||
|
s: "HTTPS://API.EXAMPLE.COM:8080/PATH",
|
||||||
|
t: "https://api.example.com:8080/path",
|
||||||
|
expected: true,
|
||||||
|
reason: "entire URL should be case-insensitive for ASCII",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "subdomain case",
|
||||||
|
s: "https://API.SUB.EXAMPLE.COM",
|
||||||
|
t: "https://api.sub.example.com",
|
||||||
|
expected: true,
|
||||||
|
reason: "subdomains should be case-insensitive",
|
||||||
|
},
|
||||||
|
|
||||||
|
// Unicode security tests (homograph attack prevention)
|
||||||
|
{
|
||||||
|
name: "cyrillic homograph attack",
|
||||||
|
s: "https://еxample.com", // Cyrillic 'е' (U+0435)
|
||||||
|
t: "https://example.com", // Latin 'e' (U+0065)
|
||||||
|
expected: false,
|
||||||
|
reason: "should block Cyrillic homograph attack",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "mixed cyrillic attack",
|
||||||
|
s: "https://ехample.com", // Cyrillic 'е' and 'х'
|
||||||
|
t: "https://example.com", // Latin 'e' and 'x'
|
||||||
|
expected: false,
|
||||||
|
reason: "should block mixed Cyrillic homograph attack",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "cyrillic 'а' attack",
|
||||||
|
s: "https://exаmple.com", // Cyrillic 'а' (U+0430)
|
||||||
|
t: "https://example.com", // Latin 'a' (U+0061)
|
||||||
|
expected: false,
|
||||||
|
reason: "should block Cyrillic 'а' homograph attack",
|
||||||
|
},
|
||||||
|
|
||||||
|
// Unicode case folding security tests
|
||||||
|
{
|
||||||
|
name: "unicode case folding attack",
|
||||||
|
s: "https://CAFÉ.com", // Latin É (U+00C9)
|
||||||
|
t: "https://café.com", // Latin é (U+00E9)
|
||||||
|
expected: false,
|
||||||
|
reason: "should NOT perform Unicode case folding (security)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "turkish i attack",
|
||||||
|
s: "https://İSTANBUL.com", // Turkish İ (U+0130)
|
||||||
|
t: "https://istanbul.com", // Latin i
|
||||||
|
expected: false,
|
||||||
|
reason: "should NOT perform Turkish case folding",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "german sharp s",
|
||||||
|
s: "https://GROß.com", // German ß (U+00DF)
|
||||||
|
t: "https://gross.com", // Expanded form
|
||||||
|
expected: false,
|
||||||
|
reason: "should NOT perform German ß expansion",
|
||||||
|
},
|
||||||
|
|
||||||
|
// Valid Unicode exact matches
|
||||||
|
{
|
||||||
|
name: "identical unicode",
|
||||||
|
s: "https://café.com",
|
||||||
|
t: "https://café.com",
|
||||||
|
expected: true,
|
||||||
|
reason: "identical Unicode strings should match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "identical cyrillic",
|
||||||
|
s: "https://пример.com", // Russian
|
||||||
|
t: "https://пример.com", // Russian
|
||||||
|
expected: true,
|
||||||
|
reason: "identical Cyrillic strings should match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "ascii part of unicode domain",
|
||||||
|
s: "HTTPS://café.COM", // ASCII parts should fold
|
||||||
|
t: "https://café.com",
|
||||||
|
expected: true,
|
||||||
|
reason: "ASCII parts should fold even in Unicode strings",
|
||||||
|
},
|
||||||
|
|
||||||
|
// Edge cases with UTF-8
|
||||||
|
{
|
||||||
|
name: "different UTF-8 byte length same rune count",
|
||||||
|
s: "Café", // é is 2 bytes
|
||||||
|
t: "Café", // é is 2 bytes (same)
|
||||||
|
expected: true,
|
||||||
|
reason: "same Unicode content should match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "UTF-8 normalization difference",
|
||||||
|
s: "café\u0301", // é as e + combining acute (3 bytes for é part)
|
||||||
|
t: "café", // é as single character (2 bytes for é part)
|
||||||
|
expected: false,
|
||||||
|
reason: "different Unicode normalization should not match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "CRITICAL: current implementation flaw",
|
||||||
|
s: "ABC" + string([]byte{0xC3, 0xA9}), // ABC + é (2 bytes) = 5 bytes
|
||||||
|
t: "abc" + string([]byte{0xC3, 0xA9}), // abc + é (2 bytes) = 5 bytes
|
||||||
|
expected: true,
|
||||||
|
reason: "should match after ASCII folding (this should pass with correct implementation)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid UTF-8 sequence",
|
||||||
|
s: "hello\xff", // Invalid UTF-8
|
||||||
|
t: "hello\xff", // Invalid UTF-8
|
||||||
|
expected: true,
|
||||||
|
reason: "identical invalid UTF-8 should match",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "different invalid UTF-8",
|
||||||
|
s: "hello\xff", // Invalid UTF-8
|
||||||
|
t: "hello\xfe", // Different invalid UTF-8
|
||||||
|
expected: false,
|
||||||
|
reason: "different invalid UTF-8 should not match",
|
||||||
|
},
|
||||||
|
|
||||||
|
// ASCII boundary tests
|
||||||
|
{
|
||||||
|
name: "ascii boundary characters",
|
||||||
|
s: "A@Z[`a{z", // Test boundaries around A-Z
|
||||||
|
t: "a@z[`A{Z",
|
||||||
|
expected: true,
|
||||||
|
reason: "only A-Z should be folded, not punctuation",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "digit boundaries",
|
||||||
|
s: "Test123ABC",
|
||||||
|
t: "test123abc",
|
||||||
|
expected: true,
|
||||||
|
reason: "digits should not be folded, only letters",
|
||||||
|
},
|
||||||
|
|
||||||
|
// Long string performance tests
|
||||||
|
{
|
||||||
|
name: "long ascii string",
|
||||||
|
s: "HTTP://" + repeatString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 100) + ".COM",
|
||||||
|
t: "http://" + repeatString("abcdefghijklmnopqrstuvwxyz", 100) + ".com",
|
||||||
|
expected: true,
|
||||||
|
reason: "long ASCII strings should be handled efficiently",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "long unicode string",
|
||||||
|
s: repeatString("CAFÉ", 100),
|
||||||
|
t: repeatString("CAFÉ", 100), // Same case - should match
|
||||||
|
expected: true,
|
||||||
|
reason: "long identical Unicode strings should match",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
result := ASCIIEqualFold(tt.s, tt.t)
|
||||||
|
if result != tt.expected {
|
||||||
|
t.Errorf("ASCIIEqualFold(%q, %q) = %v, expected %v\nReason: %s",
|
||||||
|
tt.s, tt.t, result, tt.expected, tt.reason)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper function for generating long test strings
|
||||||
|
func repeatString(s string, count int) string {
|
||||||
|
if count <= 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
result := make([]byte, 0, len(s)*count)
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
result = append(result, s...)
|
||||||
|
}
|
||||||
|
return string(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Benchmark tests for performance verification
|
||||||
|
func BenchmarkASCIIEqualFold(b *testing.B) {
|
||||||
|
benchmarks := []struct {
|
||||||
|
name string
|
||||||
|
s string
|
||||||
|
t string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "short_ascii_match",
|
||||||
|
s: "HTTP://EXAMPLE.COM",
|
||||||
|
t: "http://example.com",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "short_ascii_nomatch",
|
||||||
|
s: "HTTP://EXAMPLE.COM",
|
||||||
|
t: "http://different.com",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "long_ascii_match",
|
||||||
|
s: "HTTP://" + repeatString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 100) + ".COM",
|
||||||
|
t: "http://" + repeatString("abcdefghijklmnopqrstuvwxyz", 100) + ".com",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "unicode_nomatch",
|
||||||
|
s: "https://café.com",
|
||||||
|
t: "https://CAFÉ.com",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "unicode_exact_match",
|
||||||
|
s: "https://café.com",
|
||||||
|
t: "https://café.com",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, bm := range benchmarks {
|
||||||
|
b.Run(bm.name, func(b *testing.B) {
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
ASCIIEqualFold(bm.s, bm.t)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fuzzing test to catch edge cases
|
||||||
|
func FuzzASCIIEqualFold(f *testing.F) {
|
||||||
|
// Seed with interesting test cases
|
||||||
|
seeds := [][]string{
|
||||||
|
{"hello", "HELLO"},
|
||||||
|
{"", ""},
|
||||||
|
{"café", "CAFÉ"},
|
||||||
|
{"https://example.com", "HTTPS://EXAMPLE.COM"},
|
||||||
|
{"еxample", "example"}, // Cyrillic attack
|
||||||
|
{string([]byte{0xff}), string([]byte{0xfe})}, // Invalid UTF-8
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, seed := range seeds {
|
||||||
|
f.Add(seed[0], seed[1])
|
||||||
|
}
|
||||||
|
|
||||||
|
f.Fuzz(func(t *testing.T, s1, s2 string) {
|
||||||
|
// Just ensure it doesn't panic and returns a boolean
|
||||||
|
result := ASCIIEqualFold(s1, s2)
|
||||||
|
_ = result // Use the result to prevent optimization
|
||||||
|
|
||||||
|
// Property: function should be symmetric
|
||||||
|
if ASCIIEqualFold(s1, s2) != ASCIIEqualFold(s2, s1) {
|
||||||
|
t.Errorf("ASCIIEqualFold is not symmetric: (%q, %q)", s1, s2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Property: identical strings should always match
|
||||||
|
if s1 == s2 && !ASCIIEqualFold(s1, s2) {
|
||||||
|
t.Errorf("identical strings should match: %q", s1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
108
vendor/github.com/go-openapi/jsonpointer/.golangci.yml
generated
vendored
108
vendor/github.com/go-openapi/jsonpointer/.golangci.yml
generated
vendored
|
|
@ -1,56 +1,62 @@
|
||||||
linters-settings:
|
version: "2"
|
||||||
gocyclo:
|
linters:
|
||||||
min-complexity: 45
|
default: all
|
||||||
|
disable:
|
||||||
|
- cyclop
|
||||||
|
- depguard
|
||||||
|
- errchkjson
|
||||||
|
- errorlint
|
||||||
|
- exhaustruct
|
||||||
|
- forcetypeassert
|
||||||
|
- funlen
|
||||||
|
- gochecknoglobals
|
||||||
|
- gochecknoinits
|
||||||
|
- gocognit
|
||||||
|
- godot
|
||||||
|
- godox
|
||||||
|
- gosmopolitan
|
||||||
|
- inamedparam
|
||||||
|
- ireturn
|
||||||
|
- lll
|
||||||
|
- musttag
|
||||||
|
- nestif
|
||||||
|
- nlreturn
|
||||||
|
- nonamedreturns
|
||||||
|
- paralleltest
|
||||||
|
- testpackage
|
||||||
|
- thelper
|
||||||
|
- tparallel
|
||||||
|
- unparam
|
||||||
|
- varnamelen
|
||||||
|
- whitespace
|
||||||
|
- wrapcheck
|
||||||
|
- wsl
|
||||||
|
settings:
|
||||||
dupl:
|
dupl:
|
||||||
threshold: 200
|
threshold: 200
|
||||||
goconst:
|
goconst:
|
||||||
min-len: 2
|
min-len: 2
|
||||||
min-occurrences: 3
|
min-occurrences: 3
|
||||||
|
gocyclo:
|
||||||
linters:
|
min-complexity: 45
|
||||||
enable-all: true
|
exclusions:
|
||||||
disable:
|
generated: lax
|
||||||
- recvcheck
|
presets:
|
||||||
- unparam
|
- comments
|
||||||
- lll
|
- common-false-positives
|
||||||
- gochecknoinits
|
- legacy
|
||||||
- gochecknoglobals
|
- std-error-handling
|
||||||
- funlen
|
paths:
|
||||||
- godox
|
- third_party$
|
||||||
- gocognit
|
- builtin$
|
||||||
- whitespace
|
- examples$
|
||||||
- wsl
|
formatters:
|
||||||
- wrapcheck
|
enable:
|
||||||
- testpackage
|
- gofmt
|
||||||
- nlreturn
|
- goimports
|
||||||
- errorlint
|
exclusions:
|
||||||
- nestif
|
generated: lax
|
||||||
- godot
|
paths:
|
||||||
- gofumpt
|
- third_party$
|
||||||
- paralleltest
|
- builtin$
|
||||||
- tparallel
|
- examples$
|
||||||
- thelper
|
|
||||||
- exhaustruct
|
|
||||||
- varnamelen
|
|
||||||
- gci
|
|
||||||
- depguard
|
|
||||||
- errchkjson
|
|
||||||
- inamedparam
|
|
||||||
- nonamedreturns
|
|
||||||
- musttag
|
|
||||||
- ireturn
|
|
||||||
- forcetypeassert
|
|
||||||
- cyclop
|
|
||||||
# deprecated linters
|
|
||||||
#- deadcode
|
|
||||||
#- interfacer
|
|
||||||
#- scopelint
|
|
||||||
#- varcheck
|
|
||||||
#- structcheck
|
|
||||||
#- golint
|
|
||||||
#- nosnakecase
|
|
||||||
#- maligned
|
|
||||||
#- goerr113
|
|
||||||
#- ifshort
|
|
||||||
#- gomnd
|
|
||||||
#- exhaustivestruct
|
|
||||||
|
|
|
||||||
10
vendor/github.com/go-openapi/jsonpointer/pointer.go
generated
vendored
10
vendor/github.com/go-openapi/jsonpointer/pointer.go
generated
vendored
|
|
@ -179,6 +179,11 @@ func getSingleImpl(node any, decodedToken string, nameProvider *swag.NameProvide
|
||||||
func setSingleImpl(node, data any, decodedToken string, nameProvider *swag.NameProvider) error {
|
func setSingleImpl(node, data any, decodedToken string, nameProvider *swag.NameProvider) error {
|
||||||
rValue := reflect.Indirect(reflect.ValueOf(node))
|
rValue := reflect.Indirect(reflect.ValueOf(node))
|
||||||
|
|
||||||
|
// Check for nil to prevent panic when calling rValue.Type()
|
||||||
|
if isNil(node) {
|
||||||
|
return fmt.Errorf("cannot set field %q on nil value: %w", decodedToken, ErrPointer)
|
||||||
|
}
|
||||||
|
|
||||||
if ns, ok := node.(JSONSetable); ok { // pointer impl
|
if ns, ok := node.(JSONSetable); ok { // pointer impl
|
||||||
return ns.JSONSet(decodedToken, data)
|
return ns.JSONSet(decodedToken, data)
|
||||||
}
|
}
|
||||||
|
|
@ -285,6 +290,11 @@ func (p *Pointer) set(node, data any, nameProvider *swag.NameProvider) error {
|
||||||
return setSingleImpl(node, data, decodedToken, nameProvider)
|
return setSingleImpl(node, data, decodedToken, nameProvider)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for nil during traversal
|
||||||
|
if isNil(node) {
|
||||||
|
return fmt.Errorf("cannot traverse through nil value at %q: %w", decodedToken, ErrPointer)
|
||||||
|
}
|
||||||
|
|
||||||
rValue := reflect.Indirect(reflect.ValueOf(node))
|
rValue := reflect.Indirect(reflect.ValueOf(node))
|
||||||
kind := rValue.Kind()
|
kind := rValue.Kind()
|
||||||
|
|
||||||
|
|
|
||||||
2
vendor/github.com/mattn/go-sqlite3/README.md
generated
vendored
2
vendor/github.com/mattn/go-sqlite3/README.md
generated
vendored
|
|
@ -351,6 +351,8 @@ For example the TDM-GCC Toolchain can be found [here](https://jmeubank.github.io
|
||||||
|
|
||||||
# User Authentication
|
# User Authentication
|
||||||
|
|
||||||
|
***This is deprecated***
|
||||||
|
|
||||||
This package supports the SQLite User Authentication module.
|
This package supports the SQLite User Authentication module.
|
||||||
|
|
||||||
## Compile
|
## Compile
|
||||||
|
|
|
||||||
4488
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c
generated
vendored
4488
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c
generated
vendored
File diff suppressed because it is too large
Load diff
316
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h
generated
vendored
316
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h
generated
vendored
|
|
@ -134,7 +134,7 @@ extern "C" {
|
||||||
**
|
**
|
||||||
** Since [version 3.6.18] ([dateof:3.6.18]),
|
** Since [version 3.6.18] ([dateof:3.6.18]),
|
||||||
** SQLite source code has been stored in the
|
** SQLite source code has been stored in the
|
||||||
** <a href="http://www.fossil-scm.org/">Fossil configuration management
|
** <a href="http://fossil-scm.org/">Fossil configuration management
|
||||||
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
|
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
|
||||||
** a string which identifies a particular check-in of SQLite
|
** a string which identifies a particular check-in of SQLite
|
||||||
** within its configuration management system. ^The SQLITE_SOURCE_ID
|
** within its configuration management system. ^The SQLITE_SOURCE_ID
|
||||||
|
|
@ -147,9 +147,9 @@ extern "C" {
|
||||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||||
** [sqlite_version()] and [sqlite_source_id()].
|
** [sqlite_version()] and [sqlite_source_id()].
|
||||||
*/
|
*/
|
||||||
#define SQLITE_VERSION "3.49.1"
|
#define SQLITE_VERSION "3.50.3"
|
||||||
#define SQLITE_VERSION_NUMBER 3049001
|
#define SQLITE_VERSION_NUMBER 3050003
|
||||||
#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70"
|
#define SQLITE_SOURCE_ID "2025-07-17 13:25:10 3ce993b8657d6d9deda380a93cdd6404a8c8ba1b185b2bc423703e41ae5f2543"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Run-Time Library Version Numbers
|
** CAPI3REF: Run-Time Library Version Numbers
|
||||||
|
|
@ -1164,6 +1164,12 @@ struct sqlite3_io_methods {
|
||||||
** the value that M is to be set to. Before returning, the 32-bit signed
|
** the value that M is to be set to. Before returning, the 32-bit signed
|
||||||
** integer is overwritten with the previous value of M.
|
** integer is overwritten with the previous value of M.
|
||||||
**
|
**
|
||||||
|
** <li>[[SQLITE_FCNTL_BLOCK_ON_CONNECT]]
|
||||||
|
** The [SQLITE_FCNTL_BLOCK_ON_CONNECT] opcode is used to configure the
|
||||||
|
** VFS to block when taking a SHARED lock to connect to a wal mode database.
|
||||||
|
** This is used to implement the functionality associated with
|
||||||
|
** SQLITE_SETLK_BLOCK_ON_CONNECT.
|
||||||
|
**
|
||||||
** <li>[[SQLITE_FCNTL_DATA_VERSION]]
|
** <li>[[SQLITE_FCNTL_DATA_VERSION]]
|
||||||
** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
|
** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
|
||||||
** a database file. The argument is a pointer to a 32-bit unsigned integer.
|
** a database file. The argument is a pointer to a 32-bit unsigned integer.
|
||||||
|
|
@ -1260,6 +1266,7 @@ struct sqlite3_io_methods {
|
||||||
#define SQLITE_FCNTL_CKSM_FILE 41
|
#define SQLITE_FCNTL_CKSM_FILE 41
|
||||||
#define SQLITE_FCNTL_RESET_CACHE 42
|
#define SQLITE_FCNTL_RESET_CACHE 42
|
||||||
#define SQLITE_FCNTL_NULL_IO 43
|
#define SQLITE_FCNTL_NULL_IO 43
|
||||||
|
#define SQLITE_FCNTL_BLOCK_ON_CONNECT 44
|
||||||
|
|
||||||
/* deprecated names */
|
/* deprecated names */
|
||||||
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
||||||
|
|
@ -1990,13 +1997,16 @@ struct sqlite3_mem_methods {
|
||||||
**
|
**
|
||||||
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
|
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
|
||||||
** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
|
** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
|
||||||
** the default size of lookaside memory on each [database connection].
|
** the default size of [lookaside memory] on each [database connection].
|
||||||
** The first argument is the
|
** The first argument is the
|
||||||
** size of each lookaside buffer slot and the second is the number of
|
** size of each lookaside buffer slot ("sz") and the second is the number of
|
||||||
** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
|
** slots allocated to each database connection ("cnt").)^
|
||||||
** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
|
** ^(SQLITE_CONFIG_LOOKASIDE sets the <i>default</i> lookaside size.
|
||||||
** option to [sqlite3_db_config()] can be used to change the lookaside
|
** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can
|
||||||
** configuration on individual connections.)^ </dd>
|
** be used to change the lookaside configuration on individual connections.)^
|
||||||
|
** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the
|
||||||
|
** default lookaside configuration at compile-time.
|
||||||
|
** </dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
|
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
|
||||||
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
|
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
|
||||||
|
|
@ -2233,31 +2243,50 @@ struct sqlite3_mem_methods {
|
||||||
** [[SQLITE_DBCONFIG_LOOKASIDE]]
|
** [[SQLITE_DBCONFIG_LOOKASIDE]]
|
||||||
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
|
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
|
||||||
** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
|
** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
|
||||||
** configuration of the lookaside memory allocator within a database
|
** configuration of the [lookaside memory allocator] within a database
|
||||||
** connection.
|
** connection.
|
||||||
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
|
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
|
||||||
** in the [DBCONFIG arguments|usual format].
|
** in the [DBCONFIG arguments|usual format].
|
||||||
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
|
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
|
||||||
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
|
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
|
||||||
** should have a total of five parameters.
|
** should have a total of five parameters.
|
||||||
** ^The first argument (the third parameter to [sqlite3_db_config()] is a
|
** <ol>
|
||||||
|
** <li><p>The first argument ("buf") is a
|
||||||
** pointer to a memory buffer to use for lookaside memory.
|
** pointer to a memory buffer to use for lookaside memory.
|
||||||
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
|
** The first argument may be NULL in which case SQLite will allocate the
|
||||||
** may be NULL in which case SQLite will allocate the
|
** lookaside buffer itself using [sqlite3_malloc()].
|
||||||
** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
|
** <li><P>The second argument ("sz") is the
|
||||||
** size of each lookaside buffer slot. ^The third argument is the number of
|
** size of each lookaside buffer slot. Lookaside is disabled if "sz"
|
||||||
** slots. The size of the buffer in the first argument must be greater than
|
** is less than 8. The "sz" argument should be a multiple of 8 less than
|
||||||
** or equal to the product of the second and third arguments. The buffer
|
** 65536. If "sz" does not meet this constraint, it is reduced in size until
|
||||||
** must be aligned to an 8-byte boundary. ^If the second argument to
|
** it does.
|
||||||
** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
|
** <li><p>The third argument ("cnt") is the number of slots. Lookaside is disabled
|
||||||
** rounded down to the next smaller multiple of 8. ^(The lookaside memory
|
** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so
|
||||||
|
** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt"
|
||||||
|
** parameter is usually chosen so that the product of "sz" and "cnt" is less
|
||||||
|
** than 1,000,000.
|
||||||
|
** </ol>
|
||||||
|
** <p>If the "buf" argument is not NULL, then it must
|
||||||
|
** point to a memory buffer with a size that is greater than
|
||||||
|
** or equal to the product of "sz" and "cnt".
|
||||||
|
** The buffer must be aligned to an 8-byte boundary.
|
||||||
|
** The lookaside memory
|
||||||
** configuration for a database connection can only be changed when that
|
** configuration for a database connection can only be changed when that
|
||||||
** connection is not currently using lookaside memory, or in other words
|
** connection is not currently using lookaside memory, or in other words
|
||||||
** when the "current value" returned by
|
** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero.
|
||||||
** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
|
|
||||||
** Any attempt to change the lookaside memory configuration when lookaside
|
** Any attempt to change the lookaside memory configuration when lookaside
|
||||||
** memory is in use leaves the configuration unchanged and returns
|
** memory is in use leaves the configuration unchanged and returns
|
||||||
** [SQLITE_BUSY].)^</dd>
|
** [SQLITE_BUSY].
|
||||||
|
** If the "buf" argument is NULL and an attempt
|
||||||
|
** to allocate memory based on "sz" and "cnt" fails, then
|
||||||
|
** lookaside is silently disabled.
|
||||||
|
** <p>
|
||||||
|
** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the
|
||||||
|
** default lookaside configuration at initialization. The
|
||||||
|
** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside
|
||||||
|
** configuration at compile-time. Typical values for lookaside are 1200 for
|
||||||
|
** "sz" and 40 to 100 for "cnt".
|
||||||
|
** </dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
|
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
|
||||||
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
|
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
|
||||||
|
|
@ -2994,6 +3023,44 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
|
||||||
*/
|
*/
|
||||||
SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAPI3REF: Set the Setlk Timeout
|
||||||
|
** METHOD: sqlite3
|
||||||
|
**
|
||||||
|
** This routine is only useful in SQLITE_ENABLE_SETLK_TIMEOUT builds. If
|
||||||
|
** the VFS supports blocking locks, it sets the timeout in ms used by
|
||||||
|
** eligible locks taken on wal mode databases by the specified database
|
||||||
|
** handle. In non-SQLITE_ENABLE_SETLK_TIMEOUT builds, or if the VFS does
|
||||||
|
** not support blocking locks, this function is a no-op.
|
||||||
|
**
|
||||||
|
** Passing 0 to this function disables blocking locks altogether. Passing
|
||||||
|
** -1 to this function requests that the VFS blocks for a long time -
|
||||||
|
** indefinitely if possible. The results of passing any other negative value
|
||||||
|
** are undefined.
|
||||||
|
**
|
||||||
|
** Internally, each SQLite database handle store two timeout values - the
|
||||||
|
** busy-timeout (used for rollback mode databases, or if the VFS does not
|
||||||
|
** support blocking locks) and the setlk-timeout (used for blocking locks
|
||||||
|
** on wal-mode databases). The sqlite3_busy_timeout() method sets both
|
||||||
|
** values, this function sets only the setlk-timeout value. Therefore,
|
||||||
|
** to configure separate busy-timeout and setlk-timeout values for a single
|
||||||
|
** database handle, call sqlite3_busy_timeout() followed by this function.
|
||||||
|
**
|
||||||
|
** Whenever the number of connections to a wal mode database falls from
|
||||||
|
** 1 to 0, the last connection takes an exclusive lock on the database,
|
||||||
|
** then checkpoints and deletes the wal file. While it is doing this, any
|
||||||
|
** new connection that tries to read from the database fails with an
|
||||||
|
** SQLITE_BUSY error. Or, if the SQLITE_SETLK_BLOCK_ON_CONNECT flag is
|
||||||
|
** passed to this API, the new connection blocks until the exclusive lock
|
||||||
|
** has been released.
|
||||||
|
*/
|
||||||
|
SQLITE_API int sqlite3_setlk_timeout(sqlite3*, int ms, int flags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAPI3REF: Flags for sqlite3_setlk_timeout()
|
||||||
|
*/
|
||||||
|
#define SQLITE_SETLK_BLOCK_ON_CONNECT 0x01
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Convenience Routines For Running Queries
|
** CAPI3REF: Convenience Routines For Running Queries
|
||||||
** METHOD: sqlite3
|
** METHOD: sqlite3
|
||||||
|
|
@ -4013,7 +4080,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
|
||||||
**
|
**
|
||||||
** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
|
** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
|
||||||
** database filename D with corresponding journal file J and WAL file W and
|
** database filename D with corresponding journal file J and WAL file W and
|
||||||
** with N URI parameters key/values pairs in the array P. The result from
|
** an array P of N URI Key/Value pairs. The result from
|
||||||
** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
|
** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
|
||||||
** is safe to pass to routines like:
|
** is safe to pass to routines like:
|
||||||
** <ul>
|
** <ul>
|
||||||
|
|
@ -4694,7 +4761,7 @@ typedef struct sqlite3_context sqlite3_context;
|
||||||
** METHOD: sqlite3_stmt
|
** METHOD: sqlite3_stmt
|
||||||
**
|
**
|
||||||
** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
|
** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
|
||||||
** literals may be replaced by a [parameter] that matches one of following
|
** literals may be replaced by a [parameter] that matches one of the following
|
||||||
** templates:
|
** templates:
|
||||||
**
|
**
|
||||||
** <ul>
|
** <ul>
|
||||||
|
|
@ -4739,7 +4806,7 @@ typedef struct sqlite3_context sqlite3_context;
|
||||||
**
|
**
|
||||||
** [[byte-order determination rules]] ^The byte-order of
|
** [[byte-order determination rules]] ^The byte-order of
|
||||||
** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
|
** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
|
||||||
** found in first character, which is removed, or in the absence of a BOM
|
** found in the first character, which is removed, or in the absence of a BOM
|
||||||
** the byte order is the native byte order of the host
|
** the byte order is the native byte order of the host
|
||||||
** machine for sqlite3_bind_text16() or the byte order specified in
|
** machine for sqlite3_bind_text16() or the byte order specified in
|
||||||
** the 6th parameter for sqlite3_bind_text64().)^
|
** the 6th parameter for sqlite3_bind_text64().)^
|
||||||
|
|
@ -4759,7 +4826,7 @@ typedef struct sqlite3_context sqlite3_context;
|
||||||
** or sqlite3_bind_text16() or sqlite3_bind_text64() then
|
** or sqlite3_bind_text16() or sqlite3_bind_text64() then
|
||||||
** that parameter must be the byte offset
|
** that parameter must be the byte offset
|
||||||
** where the NUL terminator would occur assuming the string were NUL
|
** where the NUL terminator would occur assuming the string were NUL
|
||||||
** terminated. If any NUL characters occurs at byte offsets less than
|
** terminated. If any NUL characters occur at byte offsets less than
|
||||||
** the value of the fourth parameter then the resulting string value will
|
** the value of the fourth parameter then the resulting string value will
|
||||||
** contain embedded NULs. The result of expressions involving strings
|
** contain embedded NULs. The result of expressions involving strings
|
||||||
** with embedded NULs is undefined.
|
** with embedded NULs is undefined.
|
||||||
|
|
@ -4971,7 +5038,7 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
|
||||||
** METHOD: sqlite3_stmt
|
** METHOD: sqlite3_stmt
|
||||||
**
|
**
|
||||||
** ^These routines provide a means to determine the database, table, and
|
** ^These routines provide a means to determine the database, table, and
|
||||||
** table column that is the origin of a particular result column in
|
** table column that is the origin of a particular result column in a
|
||||||
** [SELECT] statement.
|
** [SELECT] statement.
|
||||||
** ^The name of the database or table or column can be returned as
|
** ^The name of the database or table or column can be returned as
|
||||||
** either a UTF-8 or UTF-16 string. ^The _database_ routines return
|
** either a UTF-8 or UTF-16 string. ^The _database_ routines return
|
||||||
|
|
@ -5109,7 +5176,7 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
|
||||||
** other than [SQLITE_ROW] before any subsequent invocation of
|
** other than [SQLITE_ROW] before any subsequent invocation of
|
||||||
** sqlite3_step(). Failure to reset the prepared statement using
|
** sqlite3_step(). Failure to reset the prepared statement using
|
||||||
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
|
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
|
||||||
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
|
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
|
||||||
** sqlite3_step() began
|
** sqlite3_step() began
|
||||||
** calling [sqlite3_reset()] automatically in this circumstance rather
|
** calling [sqlite3_reset()] automatically in this circumstance rather
|
||||||
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
|
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
|
||||||
|
|
@ -5540,8 +5607,8 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
||||||
**
|
**
|
||||||
** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
|
** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
|
||||||
** all application-defined SQL functions that do not need to be
|
** all application-defined SQL functions that do not need to be
|
||||||
** used inside of triggers, view, CHECK constraints, or other elements of
|
** used inside of triggers, views, CHECK constraints, or other elements of
|
||||||
** the database schema. This flags is especially recommended for SQL
|
** the database schema. This flag is especially recommended for SQL
|
||||||
** functions that have side effects or reveal internal application state.
|
** functions that have side effects or reveal internal application state.
|
||||||
** Without this flag, an attacker might be able to modify the schema of
|
** Without this flag, an attacker might be able to modify the schema of
|
||||||
** a database file to include invocations of the function with parameters
|
** a database file to include invocations of the function with parameters
|
||||||
|
|
@ -5572,7 +5639,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
||||||
** [user-defined window functions|available here].
|
** [user-defined window functions|available here].
|
||||||
**
|
**
|
||||||
** ^(If the final parameter to sqlite3_create_function_v2() or
|
** ^(If the final parameter to sqlite3_create_function_v2() or
|
||||||
** sqlite3_create_window_function() is not NULL, then it is destructor for
|
** sqlite3_create_window_function() is not NULL, then it is the destructor for
|
||||||
** the application data pointer. The destructor is invoked when the function
|
** the application data pointer. The destructor is invoked when the function
|
||||||
** is deleted, either by being overloaded or when the database connection
|
** is deleted, either by being overloaded or when the database connection
|
||||||
** closes.)^ ^The destructor is also invoked if the call to
|
** closes.)^ ^The destructor is also invoked if the call to
|
||||||
|
|
@ -5972,7 +6039,7 @@ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
|
||||||
** METHOD: sqlite3_value
|
** METHOD: sqlite3_value
|
||||||
**
|
**
|
||||||
** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
|
** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
|
||||||
** object D and returns a pointer to that copy. ^The [sqlite3_value] returned
|
** object V and returns a pointer to that copy. ^The [sqlite3_value] returned
|
||||||
** is a [protected sqlite3_value] object even if the input is not.
|
** is a [protected sqlite3_value] object even if the input is not.
|
||||||
** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
|
** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
|
||||||
** memory allocation fails. ^If V is a [pointer value], then the result
|
** memory allocation fails. ^If V is a [pointer value], then the result
|
||||||
|
|
@ -6010,7 +6077,7 @@ SQLITE_API void sqlite3_value_free(sqlite3_value*);
|
||||||
** allocation error occurs.
|
** allocation error occurs.
|
||||||
**
|
**
|
||||||
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
|
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
|
||||||
** determined by the N parameter on first successful call. Changing the
|
** determined by the N parameter on the first successful call. Changing the
|
||||||
** value of N in any subsequent call to sqlite3_aggregate_context() within
|
** value of N in any subsequent call to sqlite3_aggregate_context() within
|
||||||
** the same aggregate function instance will not resize the memory
|
** the same aggregate function instance will not resize the memory
|
||||||
** allocation.)^ Within the xFinal callback, it is customary to set
|
** allocation.)^ Within the xFinal callback, it is customary to set
|
||||||
|
|
@ -6172,7 +6239,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
|
||||||
**
|
**
|
||||||
** Security Warning: These interfaces should not be exposed in scripting
|
** Security Warning: These interfaces should not be exposed in scripting
|
||||||
** languages or in other circumstances where it might be possible for an
|
** languages or in other circumstances where it might be possible for an
|
||||||
** an attacker to invoke them. Any agent that can invoke these interfaces
|
** attacker to invoke them. Any agent that can invoke these interfaces
|
||||||
** can probably also take control of the process.
|
** can probably also take control of the process.
|
||||||
**
|
**
|
||||||
** Database connection client data is only available for SQLite
|
** Database connection client data is only available for SQLite
|
||||||
|
|
@ -6286,7 +6353,7 @@ typedef void (*sqlite3_destructor_type)(void*);
|
||||||
** pointed to by the 2nd parameter are taken as the application-defined
|
** pointed to by the 2nd parameter are taken as the application-defined
|
||||||
** function result. If the 3rd parameter is non-negative, then it
|
** function result. If the 3rd parameter is non-negative, then it
|
||||||
** must be the byte offset into the string where the NUL terminator would
|
** must be the byte offset into the string where the NUL terminator would
|
||||||
** appear if the string where NUL terminated. If any NUL characters occur
|
** appear if the string were NUL terminated. If any NUL characters occur
|
||||||
** in the string at a byte offset that is less than the value of the 3rd
|
** in the string at a byte offset that is less than the value of the 3rd
|
||||||
** parameter, then the resulting string will contain embedded NULs and the
|
** parameter, then the resulting string will contain embedded NULs and the
|
||||||
** result of expressions operating on strings with embedded NULs is undefined.
|
** result of expressions operating on strings with embedded NULs is undefined.
|
||||||
|
|
@ -6344,7 +6411,7 @@ typedef void (*sqlite3_destructor_type)(void*);
|
||||||
** string and preferably a string literal. The sqlite3_result_pointer()
|
** string and preferably a string literal. The sqlite3_result_pointer()
|
||||||
** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
|
** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
|
||||||
**
|
**
|
||||||
** If these routines are called from within the different thread
|
** If these routines are called from within a different thread
|
||||||
** than the one containing the application-defined function that received
|
** than the one containing the application-defined function that received
|
||||||
** the [sqlite3_context] pointer, the results are undefined.
|
** the [sqlite3_context] pointer, the results are undefined.
|
||||||
*/
|
*/
|
||||||
|
|
@ -6750,7 +6817,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
|
||||||
** METHOD: sqlite3
|
** METHOD: sqlite3
|
||||||
**
|
**
|
||||||
** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
|
** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
|
||||||
** for the N-th database on database connection D, or a NULL pointer of N is
|
** for the N-th database on database connection D, or a NULL pointer if N is
|
||||||
** out of range. An N value of 0 means the main database file. An N of 1 is
|
** out of range. An N value of 0 means the main database file. An N of 1 is
|
||||||
** the "temp" schema. Larger values of N correspond to various ATTACH-ed
|
** the "temp" schema. Larger values of N correspond to various ATTACH-ed
|
||||||
** databases.
|
** databases.
|
||||||
|
|
@ -6845,7 +6912,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
|
||||||
** <dd>The SQLITE_TXN_READ state means that the database is currently
|
** <dd>The SQLITE_TXN_READ state means that the database is currently
|
||||||
** in a read transaction. Content has been read from the database file
|
** in a read transaction. Content has been read from the database file
|
||||||
** but nothing in the database file has changed. The transaction state
|
** but nothing in the database file has changed. The transaction state
|
||||||
** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
|
** will be advanced to SQLITE_TXN_WRITE if any changes occur and there are
|
||||||
** no other conflicting concurrent write transactions. The transaction
|
** no other conflicting concurrent write transactions. The transaction
|
||||||
** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
|
** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
|
||||||
** [COMMIT].</dd>
|
** [COMMIT].</dd>
|
||||||
|
|
@ -6854,7 +6921,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
|
||||||
** <dd>The SQLITE_TXN_WRITE state means that the database is currently
|
** <dd>The SQLITE_TXN_WRITE state means that the database is currently
|
||||||
** in a write transaction. Content has been written to the database file
|
** in a write transaction. Content has been written to the database file
|
||||||
** but has not yet committed. The transaction state will change to
|
** but has not yet committed. The transaction state will change to
|
||||||
** to SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
|
** SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
|
||||||
*/
|
*/
|
||||||
#define SQLITE_TXN_NONE 0
|
#define SQLITE_TXN_NONE 0
|
||||||
#define SQLITE_TXN_READ 1
|
#define SQLITE_TXN_READ 1
|
||||||
|
|
@ -7005,6 +7072,8 @@ SQLITE_API int sqlite3_autovacuum_pages(
|
||||||
**
|
**
|
||||||
** ^The second argument is a pointer to the function to invoke when a
|
** ^The second argument is a pointer to the function to invoke when a
|
||||||
** row is updated, inserted or deleted in a rowid table.
|
** row is updated, inserted or deleted in a rowid table.
|
||||||
|
** ^The update hook is disabled by invoking sqlite3_update_hook()
|
||||||
|
** with a NULL pointer as the second parameter.
|
||||||
** ^The first argument to the callback is a copy of the third argument
|
** ^The first argument to the callback is a copy of the third argument
|
||||||
** to sqlite3_update_hook().
|
** to sqlite3_update_hook().
|
||||||
** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
|
** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
|
||||||
|
|
@ -7133,7 +7202,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
||||||
** CAPI3REF: Impose A Limit On Heap Size
|
** CAPI3REF: Impose A Limit On Heap Size
|
||||||
**
|
**
|
||||||
** These interfaces impose limits on the amount of heap memory that will be
|
** These interfaces impose limits on the amount of heap memory that will be
|
||||||
** by all database connections within a single process.
|
** used by all database connections within a single process.
|
||||||
**
|
**
|
||||||
** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
|
** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
|
||||||
** soft limit on the amount of heap memory that may be allocated by SQLite.
|
** soft limit on the amount of heap memory that may be allocated by SQLite.
|
||||||
|
|
@ -7191,7 +7260,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
||||||
** </ul>)^
|
** </ul>)^
|
||||||
**
|
**
|
||||||
** The circumstances under which SQLite will enforce the heap limits may
|
** The circumstances under which SQLite will enforce the heap limits may
|
||||||
** changes in future releases of SQLite.
|
** change in future releases of SQLite.
|
||||||
*/
|
*/
|
||||||
SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
|
SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
|
||||||
SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
|
SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
|
||||||
|
|
@ -7306,8 +7375,8 @@ SQLITE_API int sqlite3_table_column_metadata(
|
||||||
** ^The entry point is zProc.
|
** ^The entry point is zProc.
|
||||||
** ^(zProc may be 0, in which case SQLite will try to come up with an
|
** ^(zProc may be 0, in which case SQLite will try to come up with an
|
||||||
** entry point name on its own. It first tries "sqlite3_extension_init".
|
** entry point name on its own. It first tries "sqlite3_extension_init".
|
||||||
** If that does not work, it constructs a name "sqlite3_X_init" where the
|
** If that does not work, it constructs a name "sqlite3_X_init" where
|
||||||
** X is consists of the lower-case equivalent of all ASCII alphabetic
|
** X consists of the lower-case equivalent of all ASCII alphabetic
|
||||||
** characters in the filename from the last "/" to the first following
|
** characters in the filename from the last "/" to the first following
|
||||||
** "." and omitting any initial "lib".)^
|
** "." and omitting any initial "lib".)^
|
||||||
** ^The sqlite3_load_extension() interface returns
|
** ^The sqlite3_load_extension() interface returns
|
||||||
|
|
@ -7378,7 +7447,7 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
|
||||||
** ^(Even though the function prototype shows that xEntryPoint() takes
|
** ^(Even though the function prototype shows that xEntryPoint() takes
|
||||||
** no arguments and returns void, SQLite invokes xEntryPoint() with three
|
** no arguments and returns void, SQLite invokes xEntryPoint() with three
|
||||||
** arguments and expects an integer result as if the signature of the
|
** arguments and expects an integer result as if the signature of the
|
||||||
** entry point where as follows:
|
** entry point were as follows:
|
||||||
**
|
**
|
||||||
** <blockquote><pre>
|
** <blockquote><pre>
|
||||||
** int xEntryPoint(
|
** int xEntryPoint(
|
||||||
|
|
@ -7542,7 +7611,7 @@ struct sqlite3_module {
|
||||||
** virtual table and might not be checked again by the byte code.)^ ^(The
|
** virtual table and might not be checked again by the byte code.)^ ^(The
|
||||||
** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
|
** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
|
||||||
** is left in its default setting of false, the constraint will always be
|
** is left in its default setting of false, the constraint will always be
|
||||||
** checked separately in byte code. If the omit flag is change to true, then
|
** checked separately in byte code. If the omit flag is changed to true, then
|
||||||
** the constraint may or may not be checked in byte code. In other words,
|
** the constraint may or may not be checked in byte code. In other words,
|
||||||
** when the omit flag is true there is no guarantee that the constraint will
|
** when the omit flag is true there is no guarantee that the constraint will
|
||||||
** not be checked again using byte code.)^
|
** not be checked again using byte code.)^
|
||||||
|
|
@ -7568,7 +7637,7 @@ struct sqlite3_module {
|
||||||
** The xBestIndex method may optionally populate the idxFlags field with a
|
** The xBestIndex method may optionally populate the idxFlags field with a
|
||||||
** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
|
** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
|
||||||
** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
|
** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
|
||||||
** output to show the idxNum has hex instead of as decimal. Another flag is
|
** output to show the idxNum as hex instead of as decimal. Another flag is
|
||||||
** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
|
** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
|
||||||
** return at most one row.
|
** return at most one row.
|
||||||
**
|
**
|
||||||
|
|
@ -7709,7 +7778,7 @@ struct sqlite3_index_info {
|
||||||
** the implementation of the [virtual table module]. ^The fourth
|
** the implementation of the [virtual table module]. ^The fourth
|
||||||
** parameter is an arbitrary client data pointer that is passed through
|
** parameter is an arbitrary client data pointer that is passed through
|
||||||
** into the [xCreate] and [xConnect] methods of the virtual table module
|
** into the [xCreate] and [xConnect] methods of the virtual table module
|
||||||
** when a new virtual table is be being created or reinitialized.
|
** when a new virtual table is being created or reinitialized.
|
||||||
**
|
**
|
||||||
** ^The sqlite3_create_module_v2() interface has a fifth parameter which
|
** ^The sqlite3_create_module_v2() interface has a fifth parameter which
|
||||||
** is a pointer to a destructor for the pClientData. ^SQLite will
|
** is a pointer to a destructor for the pClientData. ^SQLite will
|
||||||
|
|
@ -7874,7 +7943,7 @@ typedef struct sqlite3_blob sqlite3_blob;
|
||||||
** in *ppBlob. Otherwise an [error code] is returned and, unless the error
|
** in *ppBlob. Otherwise an [error code] is returned and, unless the error
|
||||||
** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
|
** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
|
||||||
** the API is not misused, it is always safe to call [sqlite3_blob_close()]
|
** the API is not misused, it is always safe to call [sqlite3_blob_close()]
|
||||||
** on *ppBlob after this function it returns.
|
** on *ppBlob after this function returns.
|
||||||
**
|
**
|
||||||
** This function fails with SQLITE_ERROR if any of the following are true:
|
** This function fails with SQLITE_ERROR if any of the following are true:
|
||||||
** <ul>
|
** <ul>
|
||||||
|
|
@ -7994,7 +8063,7 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
|
||||||
**
|
**
|
||||||
** ^Returns the size in bytes of the BLOB accessible via the
|
** ^Returns the size in bytes of the BLOB accessible via the
|
||||||
** successfully opened [BLOB handle] in its only argument. ^The
|
** successfully opened [BLOB handle] in its only argument. ^The
|
||||||
** incremental blob I/O routines can only read or overwriting existing
|
** incremental blob I/O routines can only read or overwrite existing
|
||||||
** blob content; they cannot change the size of a blob.
|
** blob content; they cannot change the size of a blob.
|
||||||
**
|
**
|
||||||
** This routine only works on a [BLOB handle] which has been created
|
** This routine only works on a [BLOB handle] which has been created
|
||||||
|
|
@ -8144,7 +8213,7 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
|
||||||
** ^The sqlite3_mutex_alloc() routine allocates a new
|
** ^The sqlite3_mutex_alloc() routine allocates a new
|
||||||
** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
|
** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
|
||||||
** routine returns NULL if it is unable to allocate the requested
|
** routine returns NULL if it is unable to allocate the requested
|
||||||
** mutex. The argument to sqlite3_mutex_alloc() must one of these
|
** mutex. The argument to sqlite3_mutex_alloc() must be one of these
|
||||||
** integer constants:
|
** integer constants:
|
||||||
**
|
**
|
||||||
** <ul>
|
** <ul>
|
||||||
|
|
@ -8377,7 +8446,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
|
||||||
** CAPI3REF: Retrieve the mutex for a database connection
|
** CAPI3REF: Retrieve the mutex for a database connection
|
||||||
** METHOD: sqlite3
|
** METHOD: sqlite3
|
||||||
**
|
**
|
||||||
** ^This interface returns a pointer the [sqlite3_mutex] object that
|
** ^This interface returns a pointer to the [sqlite3_mutex] object that
|
||||||
** serializes access to the [database connection] given in the argument
|
** serializes access to the [database connection] given in the argument
|
||||||
** when the [threading mode] is Serialized.
|
** when the [threading mode] is Serialized.
|
||||||
** ^If the [threading mode] is Single-thread or Multi-thread then this
|
** ^If the [threading mode] is Single-thread or Multi-thread then this
|
||||||
|
|
@ -8500,7 +8569,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
||||||
** CAPI3REF: SQL Keyword Checking
|
** CAPI3REF: SQL Keyword Checking
|
||||||
**
|
**
|
||||||
** These routines provide access to the set of SQL language keywords
|
** These routines provide access to the set of SQL language keywords
|
||||||
** recognized by SQLite. Applications can uses these routines to determine
|
** recognized by SQLite. Applications can use these routines to determine
|
||||||
** whether or not a specific identifier needs to be escaped (for example,
|
** whether or not a specific identifier needs to be escaped (for example,
|
||||||
** by enclosing in double-quotes) so as not to confuse the parser.
|
** by enclosing in double-quotes) so as not to confuse the parser.
|
||||||
**
|
**
|
||||||
|
|
@ -8668,7 +8737,7 @@ SQLITE_API void sqlite3_str_reset(sqlite3_str*);
|
||||||
** content of the dynamic string under construction in X. The value
|
** content of the dynamic string under construction in X. The value
|
||||||
** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
|
** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
|
||||||
** and might be freed or altered by any subsequent method on the same
|
** and might be freed or altered by any subsequent method on the same
|
||||||
** [sqlite3_str] object. Applications must not used the pointer returned
|
** [sqlite3_str] object. Applications must not use the pointer returned by
|
||||||
** [sqlite3_str_value(X)] after any subsequent method call on the same
|
** [sqlite3_str_value(X)] after any subsequent method call on the same
|
||||||
** object. ^Applications may change the content of the string returned
|
** object. ^Applications may change the content of the string returned
|
||||||
** by [sqlite3_str_value(X)] as long as they do not write into any bytes
|
** by [sqlite3_str_value(X)] as long as they do not write into any bytes
|
||||||
|
|
@ -8754,7 +8823,7 @@ SQLITE_API int sqlite3_status64(
|
||||||
** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
|
** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
|
||||||
** buffer and where forced to overflow to [sqlite3_malloc()]. The
|
** buffer and where forced to overflow to [sqlite3_malloc()]. The
|
||||||
** returned value includes allocations that overflowed because they
|
** returned value includes allocations that overflowed because they
|
||||||
** where too large (they were larger than the "sz" parameter to
|
** were too large (they were larger than the "sz" parameter to
|
||||||
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
|
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
|
||||||
** no space was left in the page cache.</dd>)^
|
** no space was left in the page cache.</dd>)^
|
||||||
**
|
**
|
||||||
|
|
@ -8838,28 +8907,29 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
||||||
** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
|
** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
|
||||||
** <dd>This parameter returns the number of malloc attempts that were
|
** <dd>This parameter returns the number of malloc attempts that were
|
||||||
** satisfied using lookaside memory. Only the high-water value is meaningful;
|
** satisfied using lookaside memory. Only the high-water value is meaningful;
|
||||||
** the current value is always zero.)^
|
** the current value is always zero.</dd>)^
|
||||||
**
|
**
|
||||||
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
|
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
|
||||||
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
|
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
|
||||||
** <dd>This parameter returns the number malloc attempts that might have
|
** <dd>This parameter returns the number of malloc attempts that might have
|
||||||
** been satisfied using lookaside memory but failed due to the amount of
|
** been satisfied using lookaside memory but failed due to the amount of
|
||||||
** memory requested being larger than the lookaside slot size.
|
** memory requested being larger than the lookaside slot size.
|
||||||
** Only the high-water value is meaningful;
|
** Only the high-water value is meaningful;
|
||||||
** the current value is always zero.)^
|
** the current value is always zero.</dd>)^
|
||||||
**
|
**
|
||||||
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
|
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
|
||||||
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
|
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
|
||||||
** <dd>This parameter returns the number malloc attempts that might have
|
** <dd>This parameter returns the number of malloc attempts that might have
|
||||||
** been satisfied using lookaside memory but failed due to all lookaside
|
** been satisfied using lookaside memory but failed due to all lookaside
|
||||||
** memory already being in use.
|
** memory already being in use.
|
||||||
** Only the high-water value is meaningful;
|
** Only the high-water value is meaningful;
|
||||||
** the current value is always zero.)^
|
** the current value is always zero.</dd>)^
|
||||||
**
|
**
|
||||||
** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
|
** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
|
||||||
** <dd>This parameter returns the approximate number of bytes of heap
|
** <dd>This parameter returns the approximate number of bytes of heap
|
||||||
** memory used by all pager caches associated with the database connection.)^
|
** memory used by all pager caches associated with the database connection.)^
|
||||||
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
|
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
|
||||||
|
** </dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
|
** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
|
||||||
** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
|
** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
|
||||||
|
|
@ -8868,10 +8938,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
||||||
** memory used by that pager cache is divided evenly between the attached
|
** memory used by that pager cache is divided evenly between the attached
|
||||||
** connections.)^ In other words, if none of the pager caches associated
|
** connections.)^ In other words, if none of the pager caches associated
|
||||||
** with the database connection are shared, this request returns the same
|
** with the database connection are shared, this request returns the same
|
||||||
** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are
|
** value as DBSTATUS_CACHE_USED. Or, if one or more of the pager caches are
|
||||||
** shared, the value returned by this call will be smaller than that returned
|
** shared, the value returned by this call will be smaller than that returned
|
||||||
** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
|
** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
|
||||||
** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
|
** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
|
** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
|
||||||
** <dd>This parameter returns the approximate number of bytes of heap
|
** <dd>This parameter returns the approximate number of bytes of heap
|
||||||
|
|
@ -8881,6 +8951,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
||||||
** schema memory is shared with other database connections due to
|
** schema memory is shared with other database connections due to
|
||||||
** [shared cache mode] being enabled.
|
** [shared cache mode] being enabled.
|
||||||
** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
|
** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
|
||||||
|
** </dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
|
** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
|
||||||
** <dd>This parameter returns the approximate number of bytes of heap
|
** <dd>This parameter returns the approximate number of bytes of heap
|
||||||
|
|
@ -8917,7 +8988,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
||||||
** been written to disk in the middle of a transaction due to the page
|
** been written to disk in the middle of a transaction due to the page
|
||||||
** cache overflowing. Transactions are more efficient if they are written
|
** cache overflowing. Transactions are more efficient if they are written
|
||||||
** to disk all at once. When pages spill mid-transaction, that introduces
|
** to disk all at once. When pages spill mid-transaction, that introduces
|
||||||
** additional overhead. This parameter can be used help identify
|
** additional overhead. This parameter can be used to help identify
|
||||||
** inefficiencies that can be resolved by increasing the cache size.
|
** inefficiencies that can be resolved by increasing the cache size.
|
||||||
** </dd>
|
** </dd>
|
||||||
**
|
**
|
||||||
|
|
@ -8988,13 +9059,13 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
||||||
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
|
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
|
||||||
** <dd>^This is the number of sort operations that have occurred.
|
** <dd>^This is the number of sort operations that have occurred.
|
||||||
** A non-zero value in this counter may indicate an opportunity to
|
** A non-zero value in this counter may indicate an opportunity to
|
||||||
** improvement performance through careful use of indices.</dd>
|
** improve performance through careful use of indices.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
|
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
|
||||||
** <dd>^This is the number of rows inserted into transient indices that
|
** <dd>^This is the number of rows inserted into transient indices that
|
||||||
** were created automatically in order to help joins run faster.
|
** were created automatically in order to help joins run faster.
|
||||||
** A non-zero value in this counter may indicate an opportunity to
|
** A non-zero value in this counter may indicate an opportunity to
|
||||||
** improvement performance by adding permanent indices that do not
|
** improve performance by adding permanent indices that do not
|
||||||
** need to be reinitialized each time the statement is run.</dd>
|
** need to be reinitialized each time the statement is run.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
|
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
|
||||||
|
|
@ -9003,19 +9074,19 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
||||||
** to 2147483647. The number of virtual machine operations can be
|
** to 2147483647. The number of virtual machine operations can be
|
||||||
** used as a proxy for the total work done by the prepared statement.
|
** used as a proxy for the total work done by the prepared statement.
|
||||||
** If the number of virtual machine operations exceeds 2147483647
|
** If the number of virtual machine operations exceeds 2147483647
|
||||||
** then the value returned by this statement status code is undefined.
|
** then the value returned by this statement status code is undefined.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
|
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
|
||||||
** <dd>^This is the number of times that the prepare statement has been
|
** <dd>^This is the number of times that the prepare statement has been
|
||||||
** automatically regenerated due to schema changes or changes to
|
** automatically regenerated due to schema changes or changes to
|
||||||
** [bound parameters] that might affect the query plan.
|
** [bound parameters] that might affect the query plan.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
|
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
|
||||||
** <dd>^This is the number of times that the prepared statement has
|
** <dd>^This is the number of times that the prepared statement has
|
||||||
** been run. A single "run" for the purposes of this counter is one
|
** been run. A single "run" for the purposes of this counter is one
|
||||||
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
|
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
|
||||||
** The counter is incremented on the first [sqlite3_step()] call of each
|
** The counter is incremented on the first [sqlite3_step()] call of each
|
||||||
** cycle.
|
** cycle.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
|
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
|
||||||
** [[SQLITE_STMTSTATUS_FILTER HIT]]
|
** [[SQLITE_STMTSTATUS_FILTER HIT]]
|
||||||
|
|
@ -9025,7 +9096,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
||||||
** step was bypassed because a Bloom filter returned not-found. The
|
** step was bypassed because a Bloom filter returned not-found. The
|
||||||
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
|
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
|
||||||
** times that the Bloom filter returned a find, and thus the join step
|
** times that the Bloom filter returned a find, and thus the join step
|
||||||
** had to be processed as normal.
|
** had to be processed as normal.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
|
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
|
||||||
** <dd>^This is the approximate number of bytes of heap memory
|
** <dd>^This is the approximate number of bytes of heap memory
|
||||||
|
|
@ -9130,9 +9201,9 @@ struct sqlite3_pcache_page {
|
||||||
** SQLite will typically create one cache instance for each open database file,
|
** SQLite will typically create one cache instance for each open database file,
|
||||||
** though this is not guaranteed. ^The
|
** though this is not guaranteed. ^The
|
||||||
** first parameter, szPage, is the size in bytes of the pages that must
|
** first parameter, szPage, is the size in bytes of the pages that must
|
||||||
** be allocated by the cache. ^szPage will always a power of two. ^The
|
** be allocated by the cache. ^szPage will always be a power of two. ^The
|
||||||
** second parameter szExtra is a number of bytes of extra storage
|
** second parameter szExtra is a number of bytes of extra storage
|
||||||
** associated with each page cache entry. ^The szExtra parameter will
|
** associated with each page cache entry. ^The szExtra parameter will be
|
||||||
** a number less than 250. SQLite will use the
|
** a number less than 250. SQLite will use the
|
||||||
** extra szExtra bytes on each page to store metadata about the underlying
|
** extra szExtra bytes on each page to store metadata about the underlying
|
||||||
** database page on disk. The value passed into szExtra depends
|
** database page on disk. The value passed into szExtra depends
|
||||||
|
|
@ -9140,17 +9211,17 @@ struct sqlite3_pcache_page {
|
||||||
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
|
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
|
||||||
** created will be used to cache database pages of a file stored on disk, or
|
** created will be used to cache database pages of a file stored on disk, or
|
||||||
** false if it is used for an in-memory database. The cache implementation
|
** false if it is used for an in-memory database. The cache implementation
|
||||||
** does not have to do anything special based with the value of bPurgeable;
|
** does not have to do anything special based upon the value of bPurgeable;
|
||||||
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
|
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
|
||||||
** never invoke xUnpin() except to deliberately delete a page.
|
** never invoke xUnpin() except to deliberately delete a page.
|
||||||
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
|
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
|
||||||
** false will always have the "discard" flag set to true.
|
** false will always have the "discard" flag set to true.
|
||||||
** ^Hence, a cache created with bPurgeable false will
|
** ^Hence, a cache created with bPurgeable set to false will
|
||||||
** never contain any unpinned pages.
|
** never contain any unpinned pages.
|
||||||
**
|
**
|
||||||
** [[the xCachesize() page cache method]]
|
** [[the xCachesize() page cache method]]
|
||||||
** ^(The xCachesize() method may be called at any time by SQLite to set the
|
** ^(The xCachesize() method may be called at any time by SQLite to set the
|
||||||
** suggested maximum cache-size (number of pages stored by) the cache
|
** suggested maximum cache-size (number of pages stored) for the cache
|
||||||
** instance passed as the first argument. This is the value configured using
|
** instance passed as the first argument. This is the value configured using
|
||||||
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
|
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
|
||||||
** parameter, the implementation is not required to do anything with this
|
** parameter, the implementation is not required to do anything with this
|
||||||
|
|
@ -9177,12 +9248,12 @@ struct sqlite3_pcache_page {
|
||||||
** implementation must return a pointer to the page buffer with its content
|
** implementation must return a pointer to the page buffer with its content
|
||||||
** intact. If the requested page is not already in the cache, then the
|
** intact. If the requested page is not already in the cache, then the
|
||||||
** cache implementation should use the value of the createFlag
|
** cache implementation should use the value of the createFlag
|
||||||
** parameter to help it determined what action to take:
|
** parameter to help it determine what action to take:
|
||||||
**
|
**
|
||||||
** <table border=1 width=85% align=center>
|
** <table border=1 width=85% align=center>
|
||||||
** <tr><th> createFlag <th> Behavior when page is not already in cache
|
** <tr><th> createFlag <th> Behavior when page is not already in cache
|
||||||
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
|
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
|
||||||
** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
|
** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
|
||||||
** Otherwise return NULL.
|
** Otherwise return NULL.
|
||||||
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
|
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
|
||||||
** NULL if allocating a new page is effectively impossible.
|
** NULL if allocating a new page is effectively impossible.
|
||||||
|
|
@ -9199,7 +9270,7 @@ struct sqlite3_pcache_page {
|
||||||
** as its second argument. If the third parameter, discard, is non-zero,
|
** as its second argument. If the third parameter, discard, is non-zero,
|
||||||
** then the page must be evicted from the cache.
|
** then the page must be evicted from the cache.
|
||||||
** ^If the discard parameter is
|
** ^If the discard parameter is
|
||||||
** zero, then the page may be discarded or retained at the discretion of
|
** zero, then the page may be discarded or retained at the discretion of the
|
||||||
** page cache implementation. ^The page cache implementation
|
** page cache implementation. ^The page cache implementation
|
||||||
** may choose to evict unpinned pages at any time.
|
** may choose to evict unpinned pages at any time.
|
||||||
**
|
**
|
||||||
|
|
@ -9217,7 +9288,7 @@ struct sqlite3_pcache_page {
|
||||||
** When SQLite calls the xTruncate() method, the cache must discard all
|
** When SQLite calls the xTruncate() method, the cache must discard all
|
||||||
** existing cache entries with page numbers (keys) greater than or equal
|
** existing cache entries with page numbers (keys) greater than or equal
|
||||||
** to the value of the iLimit parameter passed to xTruncate(). If any
|
** to the value of the iLimit parameter passed to xTruncate(). If any
|
||||||
** of these pages are pinned, they are implicitly unpinned, meaning that
|
** of these pages are pinned, they become implicitly unpinned, meaning that
|
||||||
** they can be safely discarded.
|
** they can be safely discarded.
|
||||||
**
|
**
|
||||||
** [[the xDestroy() page cache method]]
|
** [[the xDestroy() page cache method]]
|
||||||
|
|
@ -9397,7 +9468,7 @@ typedef struct sqlite3_backup sqlite3_backup;
|
||||||
** external process or via a database connection other than the one being
|
** external process or via a database connection other than the one being
|
||||||
** used by the backup operation, then the backup will be automatically
|
** used by the backup operation, then the backup will be automatically
|
||||||
** restarted by the next call to sqlite3_backup_step(). ^If the source
|
** restarted by the next call to sqlite3_backup_step(). ^If the source
|
||||||
** database is modified by the using the same database connection as is used
|
** database is modified by using the same database connection as is used
|
||||||
** by the backup operation, then the backup database is automatically
|
** by the backup operation, then the backup database is automatically
|
||||||
** updated at the same time.
|
** updated at the same time.
|
||||||
**
|
**
|
||||||
|
|
@ -9414,7 +9485,7 @@ typedef struct sqlite3_backup sqlite3_backup;
|
||||||
** and may not be used following a call to sqlite3_backup_finish().
|
** and may not be used following a call to sqlite3_backup_finish().
|
||||||
**
|
**
|
||||||
** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
|
** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
|
||||||
** sqlite3_backup_step() errors occurred, regardless or whether or not
|
** sqlite3_backup_step() errors occurred, regardless of whether or not
|
||||||
** sqlite3_backup_step() completed.
|
** sqlite3_backup_step() completed.
|
||||||
** ^If an out-of-memory condition or IO error occurred during any prior
|
** ^If an out-of-memory condition or IO error occurred during any prior
|
||||||
** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
|
** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
|
||||||
|
|
@ -9516,7 +9587,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
||||||
** application receives an SQLITE_LOCKED error, it may call the
|
** application receives an SQLITE_LOCKED error, it may call the
|
||||||
** sqlite3_unlock_notify() method with the blocked connection handle as
|
** sqlite3_unlock_notify() method with the blocked connection handle as
|
||||||
** the first argument to register for a callback that will be invoked
|
** the first argument to register for a callback that will be invoked
|
||||||
** when the blocking connections current transaction is concluded. ^The
|
** when the blocking connection's current transaction is concluded. ^The
|
||||||
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
|
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
|
||||||
** call that concludes the blocking connection's transaction.
|
** call that concludes the blocking connection's transaction.
|
||||||
**
|
**
|
||||||
|
|
@ -9536,7 +9607,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
||||||
** blocked connection already has a registered unlock-notify callback,
|
** blocked connection already has a registered unlock-notify callback,
|
||||||
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
|
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
|
||||||
** called with a NULL pointer as its second argument, then any existing
|
** called with a NULL pointer as its second argument, then any existing
|
||||||
** unlock-notify callback is canceled. ^The blocked connections
|
** unlock-notify callback is canceled. ^The blocked connection's
|
||||||
** unlock-notify callback may also be canceled by closing the blocked
|
** unlock-notify callback may also be canceled by closing the blocked
|
||||||
** connection using [sqlite3_close()].
|
** connection using [sqlite3_close()].
|
||||||
**
|
**
|
||||||
|
|
@ -9934,7 +10005,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
||||||
** support constraints. In this configuration (which is the default) if
|
** support constraints. In this configuration (which is the default) if
|
||||||
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
|
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
|
||||||
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
|
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
|
||||||
** specified as part of the users SQL statement, regardless of the actual
|
** specified as part of the user's SQL statement, regardless of the actual
|
||||||
** ON CONFLICT mode specified.
|
** ON CONFLICT mode specified.
|
||||||
**
|
**
|
||||||
** If X is non-zero, then the virtual table implementation guarantees
|
** If X is non-zero, then the virtual table implementation guarantees
|
||||||
|
|
@ -9968,7 +10039,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
||||||
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
|
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
|
||||||
** <dd>Calls of the form
|
** <dd>Calls of the form
|
||||||
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
|
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
|
||||||
** the [xConnect] or [xCreate] methods of a [virtual table] implementation
|
** [xConnect] or [xCreate] methods of a [virtual table] implementation
|
||||||
** identify that virtual table as being safe to use from within triggers
|
** identify that virtual table as being safe to use from within triggers
|
||||||
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
|
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
|
||||||
** virtual table can do no serious harm even if it is controlled by a
|
** virtual table can do no serious harm even if it is controlled by a
|
||||||
|
|
@ -10136,7 +10207,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
||||||
** </table>
|
** </table>
|
||||||
**
|
**
|
||||||
** ^For the purposes of comparing virtual table output values to see if the
|
** ^For the purposes of comparing virtual table output values to see if the
|
||||||
** values are same value for sorting purposes, two NULL values are considered
|
** values are the same value for sorting purposes, two NULL values are considered
|
||||||
** to be the same. In other words, the comparison operator is "IS"
|
** to be the same. In other words, the comparison operator is "IS"
|
||||||
** (or "IS NOT DISTINCT FROM") and not "==".
|
** (or "IS NOT DISTINCT FROM") and not "==".
|
||||||
**
|
**
|
||||||
|
|
@ -10146,7 +10217,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
||||||
**
|
**
|
||||||
** ^A virtual table implementation is always free to return rows in any order
|
** ^A virtual table implementation is always free to return rows in any order
|
||||||
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
|
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
|
||||||
** the "orderByConsumed" flag is unset, the query planner will add extra
|
** "orderByConsumed" flag is unset, the query planner will add extra
|
||||||
** [bytecode] to ensure that the final results returned by the SQL query are
|
** [bytecode] to ensure that the final results returned by the SQL query are
|
||||||
** ordered correctly. The use of the "orderByConsumed" flag and the
|
** ordered correctly. The use of the "orderByConsumed" flag and the
|
||||||
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
|
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
|
||||||
|
|
@ -10243,7 +10314,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
|
||||||
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
|
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
|
||||||
** xFilter method which invokes these routines, and specifically
|
** xFilter method which invokes these routines, and specifically
|
||||||
** a parameter that was previously selected for all-at-once IN constraint
|
** a parameter that was previously selected for all-at-once IN constraint
|
||||||
** processing use the [sqlite3_vtab_in()] interface in the
|
** processing using the [sqlite3_vtab_in()] interface in the
|
||||||
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
|
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
|
||||||
** an xFilter argument that was selected for all-at-once IN constraint
|
** an xFilter argument that was selected for all-at-once IN constraint
|
||||||
** processing, then these routines return [SQLITE_ERROR].)^
|
** processing, then these routines return [SQLITE_ERROR].)^
|
||||||
|
|
@ -10298,7 +10369,7 @@ SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
|
||||||
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
|
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
|
||||||
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
|
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
|
||||||
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
|
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
|
||||||
** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
|
** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
|
||||||
** something goes wrong.
|
** something goes wrong.
|
||||||
**
|
**
|
||||||
** The sqlite3_vtab_rhs_value() interface is usually only successful if
|
** The sqlite3_vtab_rhs_value() interface is usually only successful if
|
||||||
|
|
@ -10326,8 +10397,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
||||||
** KEYWORDS: {conflict resolution mode}
|
** KEYWORDS: {conflict resolution mode}
|
||||||
**
|
**
|
||||||
** These constants are returned by [sqlite3_vtab_on_conflict()] to
|
** These constants are returned by [sqlite3_vtab_on_conflict()] to
|
||||||
** inform a [virtual table] implementation what the [ON CONFLICT] mode
|
** inform a [virtual table] implementation of the [ON CONFLICT] mode
|
||||||
** is for the SQL statement being evaluated.
|
** for the SQL statement being evaluated.
|
||||||
**
|
**
|
||||||
** Note that the [SQLITE_IGNORE] constant is also used as a potential
|
** Note that the [SQLITE_IGNORE] constant is also used as a potential
|
||||||
** return value from the [sqlite3_set_authorizer()] callback and that
|
** return value from the [sqlite3_set_authorizer()] callback and that
|
||||||
|
|
@ -10367,39 +10438,39 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
||||||
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
|
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
|
||||||
** <dd>^The "double" variable pointed to by the V parameter will be set to the
|
** <dd>^The "double" variable pointed to by the V parameter will be set to the
|
||||||
** query planner's estimate for the average number of rows output from each
|
** query planner's estimate for the average number of rows output from each
|
||||||
** iteration of the X-th loop. If the query planner's estimates was accurate,
|
** iteration of the X-th loop. If the query planner's estimate was accurate,
|
||||||
** then this value will approximate the quotient NVISIT/NLOOP and the
|
** then this value will approximate the quotient NVISIT/NLOOP and the
|
||||||
** product of this value for all prior loops with the same SELECTID will
|
** product of this value for all prior loops with the same SELECTID will
|
||||||
** be the NLOOP value for the current loop.
|
** be the NLOOP value for the current loop.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
|
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
|
||||||
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
||||||
** to a zero-terminated UTF-8 string containing the name of the index or table
|
** to a zero-terminated UTF-8 string containing the name of the index or table
|
||||||
** used for the X-th loop.
|
** used for the X-th loop.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
|
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
|
||||||
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
||||||
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
|
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
|
||||||
** description for the X-th loop.
|
** description for the X-th loop.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
|
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
|
||||||
** <dd>^The "int" variable pointed to by the V parameter will be set to the
|
** <dd>^The "int" variable pointed to by the V parameter will be set to the
|
||||||
** id for the X-th query plan element. The id value is unique within the
|
** id for the X-th query plan element. The id value is unique within the
|
||||||
** statement. The select-id is the same value as is output in the first
|
** statement. The select-id is the same value as is output in the first
|
||||||
** column of an [EXPLAIN QUERY PLAN] query.
|
** column of an [EXPLAIN QUERY PLAN] query.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
|
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
|
||||||
** <dd>The "int" variable pointed to by the V parameter will be set to the
|
** <dd>The "int" variable pointed to by the V parameter will be set to the
|
||||||
** the id of the parent of the current query element, if applicable, or
|
** id of the parent of the current query element, if applicable, or
|
||||||
** to zero if the query element has no parent. This is the same value as
|
** to zero if the query element has no parent. This is the same value as
|
||||||
** returned in the second column of an [EXPLAIN QUERY PLAN] query.
|
** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
|
||||||
**
|
**
|
||||||
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
|
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
|
||||||
** <dd>The sqlite3_int64 output value is set to the number of cycles,
|
** <dd>The sqlite3_int64 output value is set to the number of cycles,
|
||||||
** according to the processor time-stamp counter, that elapsed while the
|
** according to the processor time-stamp counter, that elapsed while the
|
||||||
** query element was being processed. This value is not available for
|
** query element was being processed. This value is not available for
|
||||||
** all query elements - if it is unavailable the output variable is
|
** all query elements - if it is unavailable the output variable is
|
||||||
** set to -1.
|
** set to -1.</dd>
|
||||||
** </dl>
|
** </dl>
|
||||||
*/
|
*/
|
||||||
#define SQLITE_SCANSTAT_NLOOP 0
|
#define SQLITE_SCANSTAT_NLOOP 0
|
||||||
|
|
@ -10440,8 +10511,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
||||||
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
|
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
|
||||||
**
|
**
|
||||||
** Parameter "idx" identifies the specific query element to retrieve statistics
|
** Parameter "idx" identifies the specific query element to retrieve statistics
|
||||||
** for. Query elements are numbered starting from zero. A value of -1 may be
|
** for. Query elements are numbered starting from zero. A value of -1 may
|
||||||
** to query for statistics regarding the entire query. ^If idx is out of range
|
** retrieve statistics for the entire query. ^If idx is out of range
|
||||||
** - less than -1 or greater than or equal to the total number of query
|
** - less than -1 or greater than or equal to the total number of query
|
||||||
** elements used to implement the statement - a non-zero value is returned and
|
** elements used to implement the statement - a non-zero value is returned and
|
||||||
** the variable that pOut points to is unchanged.
|
** the variable that pOut points to is unchanged.
|
||||||
|
|
@ -10484,7 +10555,7 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
|
||||||
** METHOD: sqlite3
|
** METHOD: sqlite3
|
||||||
**
|
**
|
||||||
** ^If a write-transaction is open on [database connection] D when the
|
** ^If a write-transaction is open on [database connection] D when the
|
||||||
** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
|
** [sqlite3_db_cacheflush(D)] interface is invoked, any dirty
|
||||||
** pages in the pager-cache that are not currently in use are written out
|
** pages in the pager-cache that are not currently in use are written out
|
||||||
** to disk. A dirty page may be in use if a database cursor created by an
|
** to disk. A dirty page may be in use if a database cursor created by an
|
||||||
** active SQL statement is reading from it, or if it is page 1 of a database
|
** active SQL statement is reading from it, or if it is page 1 of a database
|
||||||
|
|
@ -10598,8 +10669,8 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
||||||
** triggers; and so forth.
|
** triggers; and so forth.
|
||||||
**
|
**
|
||||||
** When the [sqlite3_blob_write()] API is used to update a blob column,
|
** When the [sqlite3_blob_write()] API is used to update a blob column,
|
||||||
** the pre-update hook is invoked with SQLITE_DELETE. This is because the
|
** the pre-update hook is invoked with SQLITE_DELETE, because
|
||||||
** in this case the new values are not available. In this case, when a
|
** the new values are not yet available. In this case, when a
|
||||||
** callback made with op==SQLITE_DELETE is actually a write using the
|
** callback made with op==SQLITE_DELETE is actually a write using the
|
||||||
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
|
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
|
||||||
** the index of the column being written. In other cases, where the
|
** the index of the column being written. In other cases, where the
|
||||||
|
|
@ -10852,7 +10923,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
||||||
** For an ordinary on-disk database file, the serialization is just a
|
** For an ordinary on-disk database file, the serialization is just a
|
||||||
** copy of the disk file. For an in-memory database or a "TEMP" database,
|
** copy of the disk file. For an in-memory database or a "TEMP" database,
|
||||||
** the serialization is the same sequence of bytes which would be written
|
** the serialization is the same sequence of bytes which would be written
|
||||||
** to disk if that database where backed up to disk.
|
** to disk if that database were backed up to disk.
|
||||||
**
|
**
|
||||||
** The usual case is that sqlite3_serialize() copies the serialization of
|
** The usual case is that sqlite3_serialize() copies the serialization of
|
||||||
** the database into memory obtained from [sqlite3_malloc64()] and returns
|
** the database into memory obtained from [sqlite3_malloc64()] and returns
|
||||||
|
|
@ -10861,7 +10932,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
||||||
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
|
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
|
||||||
** are made, and the sqlite3_serialize() function will return a pointer
|
** are made, and the sqlite3_serialize() function will return a pointer
|
||||||
** to the contiguous memory representation of the database that SQLite
|
** to the contiguous memory representation of the database that SQLite
|
||||||
** is currently using for that database, or NULL if the no such contiguous
|
** is currently using for that database, or NULL if no such contiguous
|
||||||
** memory representation of the database exists. A contiguous memory
|
** memory representation of the database exists. A contiguous memory
|
||||||
** representation of the database will usually only exist if there has
|
** representation of the database will usually only exist if there has
|
||||||
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
|
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
|
||||||
|
|
@ -10932,7 +11003,7 @@ SQLITE_API unsigned char *sqlite3_serialize(
|
||||||
** database is currently in a read transaction or is involved in a backup
|
** database is currently in a read transaction or is involved in a backup
|
||||||
** operation.
|
** operation.
|
||||||
**
|
**
|
||||||
** It is not possible to deserialized into the TEMP database. If the
|
** It is not possible to deserialize into the TEMP database. If the
|
||||||
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
|
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
|
||||||
** function returns SQLITE_ERROR.
|
** function returns SQLITE_ERROR.
|
||||||
**
|
**
|
||||||
|
|
@ -10954,7 +11025,7 @@ SQLITE_API int sqlite3_deserialize(
|
||||||
sqlite3 *db, /* The database connection */
|
sqlite3 *db, /* The database connection */
|
||||||
const char *zSchema, /* Which DB to reopen with the deserialization */
|
const char *zSchema, /* Which DB to reopen with the deserialization */
|
||||||
unsigned char *pData, /* The serialized database content */
|
unsigned char *pData, /* The serialized database content */
|
||||||
sqlite3_int64 szDb, /* Number bytes in the deserialization */
|
sqlite3_int64 szDb, /* Number of bytes in the deserialization */
|
||||||
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
|
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
|
||||||
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
|
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
|
||||||
);
|
);
|
||||||
|
|
@ -10962,7 +11033,7 @@ SQLITE_API int sqlite3_deserialize(
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Flags for sqlite3_deserialize()
|
** CAPI3REF: Flags for sqlite3_deserialize()
|
||||||
**
|
**
|
||||||
** The following are allowed values for 6th argument (the F argument) to
|
** The following are allowed values for the 6th argument (the F argument) to
|
||||||
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
|
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
|
||||||
**
|
**
|
||||||
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
|
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
|
||||||
|
|
@ -11487,9 +11558,10 @@ SQLITE_API void sqlite3session_table_filter(
|
||||||
** is inserted while a session object is enabled, then later deleted while
|
** is inserted while a session object is enabled, then later deleted while
|
||||||
** the same session object is disabled, no INSERT record will appear in the
|
** the same session object is disabled, no INSERT record will appear in the
|
||||||
** changeset, even though the delete took place while the session was disabled.
|
** changeset, even though the delete took place while the session was disabled.
|
||||||
** Or, if one field of a row is updated while a session is disabled, and
|
** Or, if one field of a row is updated while a session is enabled, and
|
||||||
** another field of the same row is updated while the session is enabled, the
|
** then another field of the same row is updated while the session is disabled,
|
||||||
** resulting changeset will contain an UPDATE change that updates both fields.
|
** the resulting changeset will contain an UPDATE change that updates both
|
||||||
|
** fields.
|
||||||
*/
|
*/
|
||||||
SQLITE_API int sqlite3session_changeset(
|
SQLITE_API int sqlite3session_changeset(
|
||||||
sqlite3_session *pSession, /* Session object */
|
sqlite3_session *pSession, /* Session object */
|
||||||
|
|
@ -11561,8 +11633,9 @@ SQLITE_API sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession
|
||||||
** database zFrom the contents of the two compatible tables would be
|
** database zFrom the contents of the two compatible tables would be
|
||||||
** identical.
|
** identical.
|
||||||
**
|
**
|
||||||
** It an error if database zFrom does not exist or does not contain the
|
** Unless the call to this function is a no-op as described above, it is an
|
||||||
** required compatible table.
|
** error if database zFrom does not exist or does not contain the required
|
||||||
|
** compatible table.
|
||||||
**
|
**
|
||||||
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
|
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
|
||||||
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
|
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
|
||||||
|
|
@ -11697,7 +11770,7 @@ SQLITE_API int sqlite3changeset_start_v2(
|
||||||
** The following flags may passed via the 4th parameter to
|
** The following flags may passed via the 4th parameter to
|
||||||
** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
|
** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
|
||||||
**
|
**
|
||||||
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
|
** <dt>SQLITE_CHANGESETSTART_INVERT <dd>
|
||||||
** Invert the changeset while iterating through it. This is equivalent to
|
** Invert the changeset while iterating through it. This is equivalent to
|
||||||
** inverting a changeset using sqlite3changeset_invert() before applying it.
|
** inverting a changeset using sqlite3changeset_invert() before applying it.
|
||||||
** It is an error to specify this flag with a patchset.
|
** It is an error to specify this flag with a patchset.
|
||||||
|
|
@ -12012,19 +12085,6 @@ SQLITE_API int sqlite3changeset_concat(
|
||||||
void **ppOut /* OUT: Buffer containing output changeset */
|
void **ppOut /* OUT: Buffer containing output changeset */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
|
|
||||||
*/
|
|
||||||
SQLITE_API int sqlite3changeset_upgrade(
|
|
||||||
sqlite3 *db,
|
|
||||||
const char *zDb,
|
|
||||||
int nIn, const void *pIn, /* Input changeset */
|
|
||||||
int *pnOut, void **ppOut /* OUT: Inverse of input */
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Changegroup Handle
|
** CAPI3REF: Changegroup Handle
|
||||||
**
|
**
|
||||||
|
|
|
||||||
149
vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go
generated
vendored
149
vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go
generated
vendored
|
|
@ -16,53 +16,10 @@ package sqlite3
|
||||||
#else
|
#else
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#endif
|
#endif
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
static int
|
|
||||||
_sqlite3_user_authenticate(sqlite3* db, const char* zUsername, const char* aPW, int nPW)
|
|
||||||
{
|
|
||||||
return sqlite3_user_authenticate(db, zUsername, aPW, nPW);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_sqlite3_user_add(sqlite3* db, const char* zUsername, const char* aPW, int nPW, int isAdmin)
|
|
||||||
{
|
|
||||||
return sqlite3_user_add(db, zUsername, aPW, nPW, isAdmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_sqlite3_user_change(sqlite3* db, const char* zUsername, const char* aPW, int nPW, int isAdmin)
|
|
||||||
{
|
|
||||||
return sqlite3_user_change(db, zUsername, aPW, nPW, isAdmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_sqlite3_user_delete(sqlite3* db, const char* zUsername)
|
|
||||||
{
|
|
||||||
return sqlite3_user_delete(db, zUsername);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_sqlite3_auth_enabled(sqlite3* db)
|
|
||||||
{
|
|
||||||
int exists = -1;
|
|
||||||
|
|
||||||
sqlite3_stmt *stmt;
|
|
||||||
sqlite3_prepare_v2(db, "select count(type) from sqlite_master WHERE type='table' and name='sqlite_user';", -1, &stmt, NULL);
|
|
||||||
|
|
||||||
while ( sqlite3_step(stmt) == SQLITE_ROW) {
|
|
||||||
exists = sqlite3_column_int(stmt, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sqlite3_finalize(stmt);
|
|
||||||
|
|
||||||
return exists;
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -72,6 +29,7 @@ const (
|
||||||
var (
|
var (
|
||||||
ErrUnauthorized = errors.New("SQLITE_AUTH: Unauthorized")
|
ErrUnauthorized = errors.New("SQLITE_AUTH: Unauthorized")
|
||||||
ErrAdminRequired = errors.New("SQLITE_AUTH: Unauthorized; Admin Privileges Required")
|
ErrAdminRequired = errors.New("SQLITE_AUTH: Unauthorized; Admin Privileges Required")
|
||||||
|
errUserAuthNoLongerSupported = errors.New("sqlite3: the sqlite_userauth tag is no longer supported as the userauth extension is no longer supported by the SQLite authors, see https://github.com/mattn/go-sqlite3/issues/1341")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Authenticate will perform an authentication of the provided username
|
// Authenticate will perform an authentication of the provided username
|
||||||
|
|
@ -88,15 +46,7 @@ var (
|
||||||
// If the SQLITE_USER table is not present in the database file, then
|
// If the SQLITE_USER table is not present in the database file, then
|
||||||
// this interface is a harmless no-op returning SQLITE_OK.
|
// this interface is a harmless no-op returning SQLITE_OK.
|
||||||
func (c *SQLiteConn) Authenticate(username, password string) error {
|
func (c *SQLiteConn) Authenticate(username, password string) error {
|
||||||
rv := c.authenticate(username, password)
|
return errUserAuthNoLongerSupported
|
||||||
switch rv {
|
|
||||||
case C.SQLITE_ERROR, C.SQLITE_AUTH:
|
|
||||||
return ErrUnauthorized
|
|
||||||
case C.SQLITE_OK:
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
return c.lastError()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// authenticate provides the actual authentication to SQLite.
|
// authenticate provides the actual authentication to SQLite.
|
||||||
|
|
@ -109,17 +59,7 @@ func (c *SQLiteConn) Authenticate(username, password string) error {
|
||||||
// C.SQLITE_ERROR (1)
|
// C.SQLITE_ERROR (1)
|
||||||
// C.SQLITE_AUTH (23)
|
// C.SQLITE_AUTH (23)
|
||||||
func (c *SQLiteConn) authenticate(username, password string) int {
|
func (c *SQLiteConn) authenticate(username, password string) int {
|
||||||
// Allocate C Variables
|
return 1
|
||||||
cuser := C.CString(username)
|
|
||||||
cpass := C.CString(password)
|
|
||||||
|
|
||||||
// Free C Variables
|
|
||||||
defer func() {
|
|
||||||
C.free(unsafe.Pointer(cuser))
|
|
||||||
C.free(unsafe.Pointer(cpass))
|
|
||||||
}()
|
|
||||||
|
|
||||||
return int(C._sqlite3_user_authenticate(c.db, cuser, cpass, C.int(len(password))))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthUserAdd can be used (by an admin user only)
|
// AuthUserAdd can be used (by an admin user only)
|
||||||
|
|
@ -131,20 +71,7 @@ func (c *SQLiteConn) authenticate(username, password string) int {
|
||||||
// for any ATTACH-ed databases. Any call to AuthUserAdd by a
|
// for any ATTACH-ed databases. Any call to AuthUserAdd by a
|
||||||
// non-admin user results in an error.
|
// non-admin user results in an error.
|
||||||
func (c *SQLiteConn) AuthUserAdd(username, password string, admin bool) error {
|
func (c *SQLiteConn) AuthUserAdd(username, password string, admin bool) error {
|
||||||
isAdmin := 0
|
return errUserAuthNoLongerSupported
|
||||||
if admin {
|
|
||||||
isAdmin = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
rv := c.authUserAdd(username, password, isAdmin)
|
|
||||||
switch rv {
|
|
||||||
case C.SQLITE_ERROR, C.SQLITE_AUTH:
|
|
||||||
return ErrAdminRequired
|
|
||||||
case C.SQLITE_OK:
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
return c.lastError()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// authUserAdd enables the User Authentication if not enabled.
|
// authUserAdd enables the User Authentication if not enabled.
|
||||||
|
|
@ -162,17 +89,7 @@ func (c *SQLiteConn) AuthUserAdd(username, password string, admin bool) error {
|
||||||
// C.SQLITE_ERROR (1)
|
// C.SQLITE_ERROR (1)
|
||||||
// C.SQLITE_AUTH (23)
|
// C.SQLITE_AUTH (23)
|
||||||
func (c *SQLiteConn) authUserAdd(username, password string, admin int) int {
|
func (c *SQLiteConn) authUserAdd(username, password string, admin int) int {
|
||||||
// Allocate C Variables
|
return 1
|
||||||
cuser := C.CString(username)
|
|
||||||
cpass := C.CString(password)
|
|
||||||
|
|
||||||
// Free C Variables
|
|
||||||
defer func() {
|
|
||||||
C.free(unsafe.Pointer(cuser))
|
|
||||||
C.free(unsafe.Pointer(cpass))
|
|
||||||
}()
|
|
||||||
|
|
||||||
return int(C._sqlite3_user_add(c.db, cuser, cpass, C.int(len(password)), C.int(admin)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthUserChange can be used to change a users
|
// AuthUserChange can be used to change a users
|
||||||
|
|
@ -181,20 +98,7 @@ func (c *SQLiteConn) authUserAdd(username, password string, admin int) int {
|
||||||
// credentials or admin privilege setting. No user may change their own
|
// credentials or admin privilege setting. No user may change their own
|
||||||
// admin privilege setting.
|
// admin privilege setting.
|
||||||
func (c *SQLiteConn) AuthUserChange(username, password string, admin bool) error {
|
func (c *SQLiteConn) AuthUserChange(username, password string, admin bool) error {
|
||||||
isAdmin := 0
|
return errUserAuthNoLongerSupported
|
||||||
if admin {
|
|
||||||
isAdmin = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
rv := c.authUserChange(username, password, isAdmin)
|
|
||||||
switch rv {
|
|
||||||
case C.SQLITE_ERROR, C.SQLITE_AUTH:
|
|
||||||
return ErrAdminRequired
|
|
||||||
case C.SQLITE_OK:
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
return c.lastError()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// authUserChange allows to modify a user.
|
// authUserChange allows to modify a user.
|
||||||
|
|
@ -215,17 +119,7 @@ func (c *SQLiteConn) AuthUserChange(username, password string, admin bool) error
|
||||||
// C.SQLITE_ERROR (1)
|
// C.SQLITE_ERROR (1)
|
||||||
// C.SQLITE_AUTH (23)
|
// C.SQLITE_AUTH (23)
|
||||||
func (c *SQLiteConn) authUserChange(username, password string, admin int) int {
|
func (c *SQLiteConn) authUserChange(username, password string, admin int) int {
|
||||||
// Allocate C Variables
|
return 1
|
||||||
cuser := C.CString(username)
|
|
||||||
cpass := C.CString(password)
|
|
||||||
|
|
||||||
// Free C Variables
|
|
||||||
defer func() {
|
|
||||||
C.free(unsafe.Pointer(cuser))
|
|
||||||
C.free(unsafe.Pointer(cpass))
|
|
||||||
}()
|
|
||||||
|
|
||||||
return int(C._sqlite3_user_change(c.db, cuser, cpass, C.int(len(password)), C.int(admin)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthUserDelete can be used (by an admin user only)
|
// AuthUserDelete can be used (by an admin user only)
|
||||||
|
|
@ -234,15 +128,7 @@ func (c *SQLiteConn) authUserChange(username, password string, admin int) int {
|
||||||
// the database cannot be converted into a no-authentication-required
|
// the database cannot be converted into a no-authentication-required
|
||||||
// database.
|
// database.
|
||||||
func (c *SQLiteConn) AuthUserDelete(username string) error {
|
func (c *SQLiteConn) AuthUserDelete(username string) error {
|
||||||
rv := c.authUserDelete(username)
|
return errUserAuthNoLongerSupported
|
||||||
switch rv {
|
|
||||||
case C.SQLITE_ERROR, C.SQLITE_AUTH:
|
|
||||||
return ErrAdminRequired
|
|
||||||
case C.SQLITE_OK:
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
return c.lastError()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// authUserDelete can be used to delete a user.
|
// authUserDelete can be used to delete a user.
|
||||||
|
|
@ -258,25 +144,12 @@ func (c *SQLiteConn) AuthUserDelete(username string) error {
|
||||||
// C.SQLITE_ERROR (1)
|
// C.SQLITE_ERROR (1)
|
||||||
// C.SQLITE_AUTH (23)
|
// C.SQLITE_AUTH (23)
|
||||||
func (c *SQLiteConn) authUserDelete(username string) int {
|
func (c *SQLiteConn) authUserDelete(username string) int {
|
||||||
// Allocate C Variables
|
return 1
|
||||||
cuser := C.CString(username)
|
|
||||||
|
|
||||||
// Free C Variables
|
|
||||||
defer func() {
|
|
||||||
C.free(unsafe.Pointer(cuser))
|
|
||||||
}()
|
|
||||||
|
|
||||||
return int(C._sqlite3_user_delete(c.db, cuser))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthEnabled checks if the database is protected by user authentication
|
// AuthEnabled checks if the database is protected by user authentication
|
||||||
func (c *SQLiteConn) AuthEnabled() (exists bool) {
|
func (c *SQLiteConn) AuthEnabled() (exists bool) {
|
||||||
rv := c.authEnabled()
|
return false
|
||||||
if rv == 1 {
|
|
||||||
exists = true
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// authEnabled perform the actual check for user authentication.
|
// authEnabled perform the actual check for user authentication.
|
||||||
|
|
@ -289,7 +162,7 @@ func (c *SQLiteConn) AuthEnabled() (exists bool) {
|
||||||
// 0 - Disabled
|
// 0 - Disabled
|
||||||
// 1 - Enabled
|
// 1 - Enabled
|
||||||
func (c *SQLiteConn) authEnabled() int {
|
func (c *SQLiteConn) authEnabled() int {
|
||||||
return int(C._sqlite3_auth_enabled(c.db))
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
|
||||||
4
vendor/github.com/mattn/go-sqlite3/sqlite3ext.h
generated
vendored
4
vendor/github.com/mattn/go-sqlite3/sqlite3ext.h
generated
vendored
|
|
@ -371,6 +371,8 @@ struct sqlite3_api_routines {
|
||||||
/* Version 3.44.0 and later */
|
/* Version 3.44.0 and later */
|
||||||
void *(*get_clientdata)(sqlite3*,const char*);
|
void *(*get_clientdata)(sqlite3*,const char*);
|
||||||
int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
|
int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
|
||||||
|
/* Version 3.50.0 and later */
|
||||||
|
int (*setlk_timeout)(sqlite3*,int,int);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -704,6 +706,8 @@ typedef int (*sqlite3_loadext_entry)(
|
||||||
/* Version 3.44.0 and later */
|
/* Version 3.44.0 and later */
|
||||||
#define sqlite3_get_clientdata sqlite3_api->get_clientdata
|
#define sqlite3_get_clientdata sqlite3_api->get_clientdata
|
||||||
#define sqlite3_set_clientdata sqlite3_api->set_clientdata
|
#define sqlite3_set_clientdata sqlite3_api->set_clientdata
|
||||||
|
/* Version 3.50.0 and later */
|
||||||
|
#define sqlite3_setlk_timeout sqlite3_api->setlk_timeout
|
||||||
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
||||||
|
|
||||||
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
||||||
|
|
|
||||||
27
vendor/github.com/spf13/pflag/README.md
generated
vendored
27
vendor/github.com/spf13/pflag/README.md
generated
vendored
|
|
@ -284,6 +284,33 @@ func main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Using pflag with go test
|
||||||
|
`pflag` does not parse the shorthand versions of go test's built-in flags (i.e., those starting with `-test.`).
|
||||||
|
For more context, see issues [#63](https://github.com/spf13/pflag/issues/63) and [#238](https://github.com/spf13/pflag/issues/238) for more details.
|
||||||
|
|
||||||
|
For example, if you use pflag in your `TestMain` function and call `pflag.Parse()` after defining your custom flags, running a test like this:
|
||||||
|
```bash
|
||||||
|
go test /your/tests -run ^YourTest -v --your-test-pflags
|
||||||
|
```
|
||||||
|
will result in the `-v` flag being ignored. This happens because of the way pflag handles flag parsing, skipping over go test's built-in shorthand flags.
|
||||||
|
To work around this, you can use the `ParseSkippedFlags` function, which ensures that go test's flags are parsed separately using the standard flag package.
|
||||||
|
|
||||||
|
**Example**: You want to parse go test flags that are otherwise ignore by `pflag.Parse()`
|
||||||
|
```go
|
||||||
|
import (
|
||||||
|
goflag "flag"
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ip *int = flag.Int("flagname", 1234, "help message for flagname")
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
|
||||||
|
flag.ParseSkippedFlags(os.Args[1:], goflag.CommandLine)
|
||||||
|
flag.Parse()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## More info
|
## More info
|
||||||
|
|
||||||
You can see the full reference documentation of the pflag package
|
You can see the full reference documentation of the pflag package
|
||||||
|
|
|
||||||
40
vendor/github.com/spf13/pflag/bool_func.go
generated
vendored
Normal file
40
vendor/github.com/spf13/pflag/bool_func.go
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
package pflag
|
||||||
|
|
||||||
|
// -- func Value
|
||||||
|
type boolfuncValue func(string) error
|
||||||
|
|
||||||
|
func (f boolfuncValue) Set(s string) error { return f(s) }
|
||||||
|
|
||||||
|
func (f boolfuncValue) Type() string { return "boolfunc" }
|
||||||
|
|
||||||
|
func (f boolfuncValue) String() string { return "" } // same behavior as stdlib 'flag' package
|
||||||
|
|
||||||
|
func (f boolfuncValue) IsBoolFlag() bool { return true }
|
||||||
|
|
||||||
|
// BoolFunc defines a func flag with specified name, callback function and usage string.
|
||||||
|
//
|
||||||
|
// The callback function will be called every time "--{name}" (or any form that matches the flag) is parsed
|
||||||
|
// on the command line.
|
||||||
|
func (f *FlagSet) BoolFunc(name string, usage string, fn func(string) error) {
|
||||||
|
f.BoolFuncP(name, "", usage, fn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// BoolFuncP is like BoolFunc, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func (f *FlagSet) BoolFuncP(name, shorthand string, usage string, fn func(string) error) {
|
||||||
|
var val Value = boolfuncValue(fn)
|
||||||
|
flag := f.VarPF(val, name, shorthand, usage)
|
||||||
|
flag.NoOptDefVal = "true"
|
||||||
|
}
|
||||||
|
|
||||||
|
// BoolFunc defines a func flag with specified name, callback function and usage string.
|
||||||
|
//
|
||||||
|
// The callback function will be called every time "--{name}" (or any form that matches the flag) is parsed
|
||||||
|
// on the command line.
|
||||||
|
func BoolFunc(name string, usage string, fn func(string) error) {
|
||||||
|
CommandLine.BoolFuncP(name, "", usage, fn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// BoolFuncP is like BoolFunc, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func BoolFuncP(name, shorthand string, usage string, fn func(string) error) {
|
||||||
|
CommandLine.BoolFuncP(name, shorthand, usage, fn)
|
||||||
|
}
|
||||||
2
vendor/github.com/spf13/pflag/count.go
generated
vendored
2
vendor/github.com/spf13/pflag/count.go
generated
vendored
|
|
@ -85,7 +85,7 @@ func (f *FlagSet) CountP(name, shorthand string, usage string) *int {
|
||||||
|
|
||||||
// Count defines a count flag with specified name, default value, and usage string.
|
// Count defines a count flag with specified name, default value, and usage string.
|
||||||
// The return value is the address of an int variable that stores the value of the flag.
|
// The return value is the address of an int variable that stores the value of the flag.
|
||||||
// A count flag will add 1 to its value evey time it is found on the command line
|
// A count flag will add 1 to its value every time it is found on the command line
|
||||||
func Count(name string, usage string) *int {
|
func Count(name string, usage string) *int {
|
||||||
return CommandLine.CountP(name, "", usage)
|
return CommandLine.CountP(name, "", usage)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
149
vendor/github.com/spf13/pflag/errors.go
generated
vendored
Normal file
149
vendor/github.com/spf13/pflag/errors.go
generated
vendored
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
package pflag
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// notExistErrorMessageType specifies which flavor of "flag does not exist"
|
||||||
|
// is printed by NotExistError. This allows the related errors to be grouped
|
||||||
|
// under a single NotExistError struct without making a breaking change to
|
||||||
|
// the error message text.
|
||||||
|
type notExistErrorMessageType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
flagNotExistMessage notExistErrorMessageType = iota
|
||||||
|
flagNotDefinedMessage
|
||||||
|
flagNoSuchFlagMessage
|
||||||
|
flagUnknownFlagMessage
|
||||||
|
flagUnknownShorthandFlagMessage
|
||||||
|
)
|
||||||
|
|
||||||
|
// NotExistError is the error returned when trying to access a flag that
|
||||||
|
// does not exist in the FlagSet.
|
||||||
|
type NotExistError struct {
|
||||||
|
name string
|
||||||
|
specifiedShorthands string
|
||||||
|
messageType notExistErrorMessageType
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error implements error.
|
||||||
|
func (e *NotExistError) Error() string {
|
||||||
|
switch e.messageType {
|
||||||
|
case flagNotExistMessage:
|
||||||
|
return fmt.Sprintf("flag %q does not exist", e.name)
|
||||||
|
|
||||||
|
case flagNotDefinedMessage:
|
||||||
|
return fmt.Sprintf("flag accessed but not defined: %s", e.name)
|
||||||
|
|
||||||
|
case flagNoSuchFlagMessage:
|
||||||
|
return fmt.Sprintf("no such flag -%v", e.name)
|
||||||
|
|
||||||
|
case flagUnknownFlagMessage:
|
||||||
|
return fmt.Sprintf("unknown flag: --%s", e.name)
|
||||||
|
|
||||||
|
case flagUnknownShorthandFlagMessage:
|
||||||
|
c := rune(e.name[0])
|
||||||
|
return fmt.Sprintf("unknown shorthand flag: %q in -%s", c, e.specifiedShorthands)
|
||||||
|
}
|
||||||
|
|
||||||
|
panic(fmt.Errorf("unknown flagNotExistErrorMessageType: %v", e.messageType))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSpecifiedName returns the name of the flag (without dashes) as it
|
||||||
|
// appeared in the parsed arguments.
|
||||||
|
func (e *NotExistError) GetSpecifiedName() string {
|
||||||
|
return e.name
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSpecifiedShortnames returns the group of shorthand arguments
|
||||||
|
// (without dashes) that the flag appeared within. If the flag was not in a
|
||||||
|
// shorthand group, this will return an empty string.
|
||||||
|
func (e *NotExistError) GetSpecifiedShortnames() string {
|
||||||
|
return e.specifiedShorthands
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValueRequiredError is the error returned when a flag needs an argument but
|
||||||
|
// no argument was provided.
|
||||||
|
type ValueRequiredError struct {
|
||||||
|
flag *Flag
|
||||||
|
specifiedName string
|
||||||
|
specifiedShorthands string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error implements error.
|
||||||
|
func (e *ValueRequiredError) Error() string {
|
||||||
|
if len(e.specifiedShorthands) > 0 {
|
||||||
|
c := rune(e.specifiedName[0])
|
||||||
|
return fmt.Sprintf("flag needs an argument: %q in -%s", c, e.specifiedShorthands)
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("flag needs an argument: --%s", e.specifiedName)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFlag returns the flag for which the error occurred.
|
||||||
|
func (e *ValueRequiredError) GetFlag() *Flag {
|
||||||
|
return e.flag
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSpecifiedName returns the name of the flag (without dashes) as it
|
||||||
|
// appeared in the parsed arguments.
|
||||||
|
func (e *ValueRequiredError) GetSpecifiedName() string {
|
||||||
|
return e.specifiedName
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSpecifiedShortnames returns the group of shorthand arguments
|
||||||
|
// (without dashes) that the flag appeared within. If the flag was not in a
|
||||||
|
// shorthand group, this will return an empty string.
|
||||||
|
func (e *ValueRequiredError) GetSpecifiedShortnames() string {
|
||||||
|
return e.specifiedShorthands
|
||||||
|
}
|
||||||
|
|
||||||
|
// InvalidValueError is the error returned when an invalid value is used
|
||||||
|
// for a flag.
|
||||||
|
type InvalidValueError struct {
|
||||||
|
flag *Flag
|
||||||
|
value string
|
||||||
|
cause error
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error implements error.
|
||||||
|
func (e *InvalidValueError) Error() string {
|
||||||
|
flag := e.flag
|
||||||
|
var flagName string
|
||||||
|
if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
|
||||||
|
flagName = fmt.Sprintf("-%s, --%s", flag.Shorthand, flag.Name)
|
||||||
|
} else {
|
||||||
|
flagName = fmt.Sprintf("--%s", flag.Name)
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("invalid argument %q for %q flag: %v", e.value, flagName, e.cause)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unwrap implements errors.Unwrap.
|
||||||
|
func (e *InvalidValueError) Unwrap() error {
|
||||||
|
return e.cause
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFlag returns the flag for which the error occurred.
|
||||||
|
func (e *InvalidValueError) GetFlag() *Flag {
|
||||||
|
return e.flag
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetValue returns the invalid value that was provided.
|
||||||
|
func (e *InvalidValueError) GetValue() string {
|
||||||
|
return e.value
|
||||||
|
}
|
||||||
|
|
||||||
|
// InvalidSyntaxError is the error returned when a bad flag name is passed on
|
||||||
|
// the command line.
|
||||||
|
type InvalidSyntaxError struct {
|
||||||
|
specifiedFlag string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error implements error.
|
||||||
|
func (e *InvalidSyntaxError) Error() string {
|
||||||
|
return fmt.Sprintf("bad flag syntax: %s", e.specifiedFlag)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSpecifiedName returns the exact flag (with dashes) as it
|
||||||
|
// appeared in the parsed arguments.
|
||||||
|
func (e *InvalidSyntaxError) GetSpecifiedFlag() string {
|
||||||
|
return e.specifiedFlag
|
||||||
|
}
|
||||||
79
vendor/github.com/spf13/pflag/flag.go
generated
vendored
79
vendor/github.com/spf13/pflag/flag.go
generated
vendored
|
|
@ -27,23 +27,32 @@ unaffected.
|
||||||
Define flags using flag.String(), Bool(), Int(), etc.
|
Define flags using flag.String(), Bool(), Int(), etc.
|
||||||
|
|
||||||
This declares an integer flag, -flagname, stored in the pointer ip, with type *int.
|
This declares an integer flag, -flagname, stored in the pointer ip, with type *int.
|
||||||
|
|
||||||
var ip = flag.Int("flagname", 1234, "help message for flagname")
|
var ip = flag.Int("flagname", 1234, "help message for flagname")
|
||||||
|
|
||||||
If you like, you can bind the flag to a variable using the Var() functions.
|
If you like, you can bind the flag to a variable using the Var() functions.
|
||||||
|
|
||||||
var flagvar int
|
var flagvar int
|
||||||
func init() {
|
func init() {
|
||||||
flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
|
flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
|
||||||
}
|
}
|
||||||
|
|
||||||
Or you can create custom flags that satisfy the Value interface (with
|
Or you can create custom flags that satisfy the Value interface (with
|
||||||
pointer receivers) and couple them to flag parsing by
|
pointer receivers) and couple them to flag parsing by
|
||||||
|
|
||||||
flag.Var(&flagVal, "name", "help message for flagname")
|
flag.Var(&flagVal, "name", "help message for flagname")
|
||||||
|
|
||||||
For such flags, the default value is just the initial value of the variable.
|
For such flags, the default value is just the initial value of the variable.
|
||||||
|
|
||||||
After all flags are defined, call
|
After all flags are defined, call
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
to parse the command line into the defined flags.
|
to parse the command line into the defined flags.
|
||||||
|
|
||||||
Flags may then be used directly. If you're using the flags themselves,
|
Flags may then be used directly. If you're using the flags themselves,
|
||||||
they are all pointers; if you bind to variables, they're values.
|
they are all pointers; if you bind to variables, they're values.
|
||||||
|
|
||||||
fmt.Println("ip has value ", *ip)
|
fmt.Println("ip has value ", *ip)
|
||||||
fmt.Println("flagvar has value ", flagvar)
|
fmt.Println("flagvar has value ", flagvar)
|
||||||
|
|
||||||
|
|
@ -54,22 +63,26 @@ The arguments are indexed from 0 through flag.NArg()-1.
|
||||||
The pflag package also defines some new functions that are not in flag,
|
The pflag package also defines some new functions that are not in flag,
|
||||||
that give one-letter shorthands for flags. You can use these by appending
|
that give one-letter shorthands for flags. You can use these by appending
|
||||||
'P' to the name of any function that defines a flag.
|
'P' to the name of any function that defines a flag.
|
||||||
|
|
||||||
var ip = flag.IntP("flagname", "f", 1234, "help message")
|
var ip = flag.IntP("flagname", "f", 1234, "help message")
|
||||||
var flagvar bool
|
var flagvar bool
|
||||||
func init() {
|
func init() {
|
||||||
flag.BoolVarP(&flagvar, "boolname", "b", true, "help message")
|
flag.BoolVarP(&flagvar, "boolname", "b", true, "help message")
|
||||||
}
|
}
|
||||||
flag.VarP(&flagval, "varname", "v", "help message")
|
flag.VarP(&flagval, "varname", "v", "help message")
|
||||||
|
|
||||||
Shorthand letters can be used with single dashes on the command line.
|
Shorthand letters can be used with single dashes on the command line.
|
||||||
Boolean shorthand flags can be combined with other shorthand flags.
|
Boolean shorthand flags can be combined with other shorthand flags.
|
||||||
|
|
||||||
Command line flag syntax:
|
Command line flag syntax:
|
||||||
|
|
||||||
--flag // boolean flags only
|
--flag // boolean flags only
|
||||||
--flag=x
|
--flag=x
|
||||||
|
|
||||||
Unlike the flag package, a single dash before an option means something
|
Unlike the flag package, a single dash before an option means something
|
||||||
different than a double dash. Single dashes signify a series of shorthand
|
different than a double dash. Single dashes signify a series of shorthand
|
||||||
letters for flags. All but the last shorthand letter must be boolean flags.
|
letters for flags. All but the last shorthand letter must be boolean flags.
|
||||||
|
|
||||||
// boolean flags
|
// boolean flags
|
||||||
-f
|
-f
|
||||||
-abc
|
-abc
|
||||||
|
|
@ -381,7 +394,7 @@ func (f *FlagSet) lookup(name NormalizedName) *Flag {
|
||||||
func (f *FlagSet) getFlagType(name string, ftype string, convFunc func(sval string) (interface{}, error)) (interface{}, error) {
|
func (f *FlagSet) getFlagType(name string, ftype string, convFunc func(sval string) (interface{}, error)) (interface{}, error) {
|
||||||
flag := f.Lookup(name)
|
flag := f.Lookup(name)
|
||||||
if flag == nil {
|
if flag == nil {
|
||||||
err := fmt.Errorf("flag accessed but not defined: %s", name)
|
err := &NotExistError{name: name, messageType: flagNotDefinedMessage}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -411,7 +424,7 @@ func (f *FlagSet) ArgsLenAtDash() int {
|
||||||
func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
|
func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
|
||||||
flag := f.Lookup(name)
|
flag := f.Lookup(name)
|
||||||
if flag == nil {
|
if flag == nil {
|
||||||
return fmt.Errorf("flag %q does not exist", name)
|
return &NotExistError{name: name, messageType: flagNotExistMessage}
|
||||||
}
|
}
|
||||||
if usageMessage == "" {
|
if usageMessage == "" {
|
||||||
return fmt.Errorf("deprecated message for flag %q must be set", name)
|
return fmt.Errorf("deprecated message for flag %q must be set", name)
|
||||||
|
|
@ -427,7 +440,7 @@ func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
|
||||||
func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) error {
|
func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) error {
|
||||||
flag := f.Lookup(name)
|
flag := f.Lookup(name)
|
||||||
if flag == nil {
|
if flag == nil {
|
||||||
return fmt.Errorf("flag %q does not exist", name)
|
return &NotExistError{name: name, messageType: flagNotExistMessage}
|
||||||
}
|
}
|
||||||
if usageMessage == "" {
|
if usageMessage == "" {
|
||||||
return fmt.Errorf("deprecated message for flag %q must be set", name)
|
return fmt.Errorf("deprecated message for flag %q must be set", name)
|
||||||
|
|
@ -441,7 +454,7 @@ func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) erro
|
||||||
func (f *FlagSet) MarkHidden(name string) error {
|
func (f *FlagSet) MarkHidden(name string) error {
|
||||||
flag := f.Lookup(name)
|
flag := f.Lookup(name)
|
||||||
if flag == nil {
|
if flag == nil {
|
||||||
return fmt.Errorf("flag %q does not exist", name)
|
return &NotExistError{name: name, messageType: flagNotExistMessage}
|
||||||
}
|
}
|
||||||
flag.Hidden = true
|
flag.Hidden = true
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -464,18 +477,16 @@ func (f *FlagSet) Set(name, value string) error {
|
||||||
normalName := f.normalizeFlagName(name)
|
normalName := f.normalizeFlagName(name)
|
||||||
flag, ok := f.formal[normalName]
|
flag, ok := f.formal[normalName]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("no such flag -%v", name)
|
return &NotExistError{name: name, messageType: flagNoSuchFlagMessage}
|
||||||
}
|
}
|
||||||
|
|
||||||
err := flag.Value.Set(value)
|
err := flag.Value.Set(value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var flagName string
|
return &InvalidValueError{
|
||||||
if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
|
flag: flag,
|
||||||
flagName = fmt.Sprintf("-%s, --%s", flag.Shorthand, flag.Name)
|
value: value,
|
||||||
} else {
|
cause: err,
|
||||||
flagName = fmt.Sprintf("--%s", flag.Name)
|
|
||||||
}
|
}
|
||||||
return fmt.Errorf("invalid argument %q for %q flag: %v", value, flagName, err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !flag.Changed {
|
if !flag.Changed {
|
||||||
|
|
@ -501,7 +512,7 @@ func (f *FlagSet) SetAnnotation(name, key string, values []string) error {
|
||||||
normalName := f.normalizeFlagName(name)
|
normalName := f.normalizeFlagName(name)
|
||||||
flag, ok := f.formal[normalName]
|
flag, ok := f.formal[normalName]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("no such flag -%v", name)
|
return &NotExistError{name: name, messageType: flagNoSuchFlagMessage}
|
||||||
}
|
}
|
||||||
if flag.Annotations == nil {
|
if flag.Annotations == nil {
|
||||||
flag.Annotations = map[string][]string{}
|
flag.Annotations = map[string][]string{}
|
||||||
|
|
@ -538,7 +549,7 @@ func (f *FlagSet) PrintDefaults() {
|
||||||
func (f *Flag) defaultIsZeroValue() bool {
|
func (f *Flag) defaultIsZeroValue() bool {
|
||||||
switch f.Value.(type) {
|
switch f.Value.(type) {
|
||||||
case boolFlag:
|
case boolFlag:
|
||||||
return f.DefValue == "false"
|
return f.DefValue == "false" || f.DefValue == ""
|
||||||
case *durationValue:
|
case *durationValue:
|
||||||
// Beginning in Go 1.7, duration zero values are "0s"
|
// Beginning in Go 1.7, duration zero values are "0s"
|
||||||
return f.DefValue == "0" || f.DefValue == "0s"
|
return f.DefValue == "0" || f.DefValue == "0s"
|
||||||
|
|
@ -551,7 +562,7 @@ func (f *Flag) defaultIsZeroValue() bool {
|
||||||
case *intSliceValue, *stringSliceValue, *stringArrayValue:
|
case *intSliceValue, *stringSliceValue, *stringArrayValue:
|
||||||
return f.DefValue == "[]"
|
return f.DefValue == "[]"
|
||||||
default:
|
default:
|
||||||
switch f.Value.String() {
|
switch f.DefValue {
|
||||||
case "false":
|
case "false":
|
||||||
return true
|
return true
|
||||||
case "<nil>":
|
case "<nil>":
|
||||||
|
|
@ -588,8 +599,10 @@ func UnquoteUsage(flag *Flag) (name string, usage string) {
|
||||||
|
|
||||||
name = flag.Value.Type()
|
name = flag.Value.Type()
|
||||||
switch name {
|
switch name {
|
||||||
case "bool":
|
case "bool", "boolfunc":
|
||||||
name = ""
|
name = ""
|
||||||
|
case "func":
|
||||||
|
name = "value"
|
||||||
case "float64":
|
case "float64":
|
||||||
name = "float"
|
name = "float"
|
||||||
case "int64":
|
case "int64":
|
||||||
|
|
@ -707,7 +720,7 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
|
||||||
switch flag.Value.Type() {
|
switch flag.Value.Type() {
|
||||||
case "string":
|
case "string":
|
||||||
line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal)
|
line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal)
|
||||||
case "bool":
|
case "bool", "boolfunc":
|
||||||
if flag.NoOptDefVal != "true" {
|
if flag.NoOptDefVal != "true" {
|
||||||
line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
|
line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
|
||||||
}
|
}
|
||||||
|
|
@ -911,10 +924,9 @@ func VarP(value Value, name, shorthand, usage string) {
|
||||||
CommandLine.VarP(value, name, shorthand, usage)
|
CommandLine.VarP(value, name, shorthand, usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// failf prints to standard error a formatted error and usage message and
|
// fail prints an error message and usage message to standard error and
|
||||||
// returns the error.
|
// returns the error.
|
||||||
func (f *FlagSet) failf(format string, a ...interface{}) error {
|
func (f *FlagSet) fail(err error) error {
|
||||||
err := fmt.Errorf(format, a...)
|
|
||||||
if f.errorHandling != ContinueOnError {
|
if f.errorHandling != ContinueOnError {
|
||||||
fmt.Fprintln(f.Output(), err)
|
fmt.Fprintln(f.Output(), err)
|
||||||
f.usage()
|
f.usage()
|
||||||
|
|
@ -960,7 +972,7 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
|
||||||
a = args
|
a = args
|
||||||
name := s[2:]
|
name := s[2:]
|
||||||
if len(name) == 0 || name[0] == '-' || name[0] == '=' {
|
if len(name) == 0 || name[0] == '-' || name[0] == '=' {
|
||||||
err = f.failf("bad flag syntax: %s", s)
|
err = f.fail(&InvalidSyntaxError{specifiedFlag: s})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -982,7 +994,7 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
|
||||||
|
|
||||||
return stripUnknownFlagValue(a), nil
|
return stripUnknownFlagValue(a), nil
|
||||||
default:
|
default:
|
||||||
err = f.failf("unknown flag: --%s", name)
|
err = f.fail(&NotExistError{name: name, messageType: flagUnknownFlagMessage})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1000,13 +1012,16 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
|
||||||
a = a[1:]
|
a = a[1:]
|
||||||
} else {
|
} else {
|
||||||
// '--flag' (arg was required)
|
// '--flag' (arg was required)
|
||||||
err = f.failf("flag needs an argument: %s", s)
|
err = f.fail(&ValueRequiredError{
|
||||||
|
flag: flag,
|
||||||
|
specifiedName: name,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = fn(flag, value)
|
err = fn(flag, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
f.failf(err.Error())
|
f.fail(err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -1014,7 +1029,7 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
|
||||||
func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) {
|
func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) {
|
||||||
outArgs = args
|
outArgs = args
|
||||||
|
|
||||||
if strings.HasPrefix(shorthands, "test.") {
|
if isGotestShorthandFlag(shorthands) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1039,7 +1054,11 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
|
||||||
outArgs = stripUnknownFlagValue(outArgs)
|
outArgs = stripUnknownFlagValue(outArgs)
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands)
|
err = f.fail(&NotExistError{
|
||||||
|
name: string(c),
|
||||||
|
specifiedShorthands: shorthands,
|
||||||
|
messageType: flagUnknownShorthandFlagMessage,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1062,7 +1081,11 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
|
||||||
outArgs = args[1:]
|
outArgs = args[1:]
|
||||||
} else {
|
} else {
|
||||||
// '-f' (arg was required)
|
// '-f' (arg was required)
|
||||||
err = f.failf("flag needs an argument: %q in -%s", c, shorthands)
|
err = f.fail(&ValueRequiredError{
|
||||||
|
flag: flag,
|
||||||
|
specifiedName: string(c),
|
||||||
|
specifiedShorthands: shorthands,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1072,7 +1095,7 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
|
||||||
|
|
||||||
err = fn(flag, value)
|
err = fn(flag, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
f.failf(err.Error())
|
f.fail(err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -1135,7 +1158,7 @@ func (f *FlagSet) Parse(arguments []string) error {
|
||||||
}
|
}
|
||||||
f.parsed = true
|
f.parsed = true
|
||||||
|
|
||||||
if len(arguments) < 0 {
|
if len(arguments) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
37
vendor/github.com/spf13/pflag/func.go
generated
vendored
Normal file
37
vendor/github.com/spf13/pflag/func.go
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
package pflag
|
||||||
|
|
||||||
|
// -- func Value
|
||||||
|
type funcValue func(string) error
|
||||||
|
|
||||||
|
func (f funcValue) Set(s string) error { return f(s) }
|
||||||
|
|
||||||
|
func (f funcValue) Type() string { return "func" }
|
||||||
|
|
||||||
|
func (f funcValue) String() string { return "" } // same behavior as stdlib 'flag' package
|
||||||
|
|
||||||
|
// Func defines a func flag with specified name, callback function and usage string.
|
||||||
|
//
|
||||||
|
// The callback function will be called every time "--{name}={value}" (or equivalent) is
|
||||||
|
// parsed on the command line, with "{value}" as an argument.
|
||||||
|
func (f *FlagSet) Func(name string, usage string, fn func(string) error) {
|
||||||
|
f.FuncP(name, "", usage, fn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FuncP is like Func, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func (f *FlagSet) FuncP(name string, shorthand string, usage string, fn func(string) error) {
|
||||||
|
var val Value = funcValue(fn)
|
||||||
|
f.VarP(val, name, shorthand, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Func defines a func flag with specified name, callback function and usage string.
|
||||||
|
//
|
||||||
|
// The callback function will be called every time "--{name}={value}" (or equivalent) is
|
||||||
|
// parsed on the command line, with "{value}" as an argument.
|
||||||
|
func Func(name string, usage string, fn func(string) error) {
|
||||||
|
CommandLine.FuncP(name, "", usage, fn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FuncP is like Func, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func FuncP(name, shorthand string, usage string, fn func(string) error) {
|
||||||
|
CommandLine.FuncP(name, shorthand, usage, fn)
|
||||||
|
}
|
||||||
22
vendor/github.com/spf13/pflag/golangflag.go
generated
vendored
22
vendor/github.com/spf13/pflag/golangflag.go
generated
vendored
|
|
@ -10,6 +10,15 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// go test flags prefixes
|
||||||
|
func isGotestFlag(flag string) bool {
|
||||||
|
return strings.HasPrefix(flag, "-test.")
|
||||||
|
}
|
||||||
|
|
||||||
|
func isGotestShorthandFlag(flag string) bool {
|
||||||
|
return strings.HasPrefix(flag, "test.")
|
||||||
|
}
|
||||||
|
|
||||||
// flagValueWrapper implements pflag.Value around a flag.Value. The main
|
// flagValueWrapper implements pflag.Value around a flag.Value. The main
|
||||||
// difference here is the addition of the Type method that returns a string
|
// difference here is the addition of the Type method that returns a string
|
||||||
// name of the type. As this is generally unknown, we approximate that with
|
// name of the type. As this is generally unknown, we approximate that with
|
||||||
|
|
@ -103,3 +112,16 @@ func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) {
|
||||||
}
|
}
|
||||||
f.addedGoFlagSets = append(f.addedGoFlagSets, newSet)
|
f.addedGoFlagSets = append(f.addedGoFlagSets, newSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ParseSkippedFlags explicitly Parses go test flags (i.e. the one starting with '-test.') with goflag.Parse(),
|
||||||
|
// since by default those are skipped by pflag.Parse().
|
||||||
|
// Typical usage example: `ParseGoTestFlags(os.Args[1:], goflag.CommandLine)`
|
||||||
|
func ParseSkippedFlags(osArgs []string, goFlagSet *goflag.FlagSet) error {
|
||||||
|
var skippedFlags []string
|
||||||
|
for _, f := range osArgs {
|
||||||
|
if isGotestFlag(f) {
|
||||||
|
skippedFlags = append(skippedFlags, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return goFlagSet.Parse(skippedFlags)
|
||||||
|
}
|
||||||
|
|
|
||||||
2
vendor/github.com/spf13/pflag/ipnet_slice.go
generated
vendored
2
vendor/github.com/spf13/pflag/ipnet_slice.go
generated
vendored
|
|
@ -73,7 +73,7 @@ func (s *ipNetSliceValue) String() string {
|
||||||
|
|
||||||
func ipNetSliceConv(val string) (interface{}, error) {
|
func ipNetSliceConv(val string) (interface{}, error) {
|
||||||
val = strings.Trim(val, "[]")
|
val = strings.Trim(val, "[]")
|
||||||
// Emtpy string would cause a slice with one (empty) entry
|
// Empty string would cause a slice with one (empty) entry
|
||||||
if len(val) == 0 {
|
if len(val) == 0 {
|
||||||
return []net.IPNet{}, nil
|
return []net.IPNet{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
81
vendor/github.com/spf13/pflag/text.go
generated
vendored
Normal file
81
vendor/github.com/spf13/pflag/text.go
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
package pflag
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding"
|
||||||
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// following is copied from go 1.23.4 flag.go
|
||||||
|
type textValue struct{ p encoding.TextUnmarshaler }
|
||||||
|
|
||||||
|
func newTextValue(val encoding.TextMarshaler, p encoding.TextUnmarshaler) textValue {
|
||||||
|
ptrVal := reflect.ValueOf(p)
|
||||||
|
if ptrVal.Kind() != reflect.Ptr {
|
||||||
|
panic("variable value type must be a pointer")
|
||||||
|
}
|
||||||
|
defVal := reflect.ValueOf(val)
|
||||||
|
if defVal.Kind() == reflect.Ptr {
|
||||||
|
defVal = defVal.Elem()
|
||||||
|
}
|
||||||
|
if defVal.Type() != ptrVal.Type().Elem() {
|
||||||
|
panic(fmt.Sprintf("default type does not match variable type: %v != %v", defVal.Type(), ptrVal.Type().Elem()))
|
||||||
|
}
|
||||||
|
ptrVal.Elem().Set(defVal)
|
||||||
|
return textValue{p}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v textValue) Set(s string) error {
|
||||||
|
return v.p.UnmarshalText([]byte(s))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v textValue) Get() interface{} {
|
||||||
|
return v.p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v textValue) String() string {
|
||||||
|
if m, ok := v.p.(encoding.TextMarshaler); ok {
|
||||||
|
if b, err := m.MarshalText(); err == nil {
|
||||||
|
return string(b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//end of copy
|
||||||
|
|
||||||
|
func (v textValue) Type() string {
|
||||||
|
return reflect.ValueOf(v.p).Type().Name()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetText set out, which implements encoding.UnmarshalText, to the value of a flag with given name
|
||||||
|
func (f *FlagSet) GetText(name string, out encoding.TextUnmarshaler) error {
|
||||||
|
flag := f.Lookup(name)
|
||||||
|
if flag == nil {
|
||||||
|
return fmt.Errorf("flag accessed but not defined: %s", name)
|
||||||
|
}
|
||||||
|
if flag.Value.Type() != reflect.TypeOf(out).Name() {
|
||||||
|
return fmt.Errorf("trying to get %s value of flag of type %s", reflect.TypeOf(out).Name(), flag.Value.Type())
|
||||||
|
}
|
||||||
|
return out.UnmarshalText([]byte(flag.Value.String()))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TextVar defines a flag with a specified name, default value, and usage string. The argument p must be a pointer to a variable that will hold the value of the flag, and p must implement encoding.TextUnmarshaler. If the flag is used, the flag value will be passed to p's UnmarshalText method. The type of the default value must be the same as the type of p.
|
||||||
|
func (f *FlagSet) TextVar(p encoding.TextUnmarshaler, name string, value encoding.TextMarshaler, usage string) {
|
||||||
|
f.VarP(newTextValue(value, p), name, "", usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TextVarP is like TextVar, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func (f *FlagSet) TextVarP(p encoding.TextUnmarshaler, name, shorthand string, value encoding.TextMarshaler, usage string) {
|
||||||
|
f.VarP(newTextValue(value, p), name, shorthand, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TextVar defines a flag with a specified name, default value, and usage string. The argument p must be a pointer to a variable that will hold the value of the flag, and p must implement encoding.TextUnmarshaler. If the flag is used, the flag value will be passed to p's UnmarshalText method. The type of the default value must be the same as the type of p.
|
||||||
|
func TextVar(p encoding.TextUnmarshaler, name string, value encoding.TextMarshaler, usage string) {
|
||||||
|
CommandLine.VarP(newTextValue(value, p), name, "", usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TextVarP is like TextVar, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func TextVarP(p encoding.TextUnmarshaler, name, shorthand string, value encoding.TextMarshaler, usage string) {
|
||||||
|
CommandLine.VarP(newTextValue(value, p), name, shorthand, usage)
|
||||||
|
}
|
||||||
118
vendor/github.com/spf13/pflag/time.go
generated
vendored
Normal file
118
vendor/github.com/spf13/pflag/time.go
generated
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
package pflag
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TimeValue adapts time.Time for use as a flag.
|
||||||
|
type timeValue struct {
|
||||||
|
*time.Time
|
||||||
|
formats []string
|
||||||
|
}
|
||||||
|
|
||||||
|
func newTimeValue(val time.Time, p *time.Time, formats []string) *timeValue {
|
||||||
|
*p = val
|
||||||
|
return &timeValue{
|
||||||
|
Time: p,
|
||||||
|
formats: formats,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set time.Time value from string based on accepted formats.
|
||||||
|
func (d *timeValue) Set(s string) error {
|
||||||
|
s = strings.TrimSpace(s)
|
||||||
|
for _, f := range d.formats {
|
||||||
|
v, err := time.Parse(f, s)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
*d.Time = v
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
formatsString := ""
|
||||||
|
for i, f := range d.formats {
|
||||||
|
if i > 0 {
|
||||||
|
formatsString += ", "
|
||||||
|
}
|
||||||
|
formatsString += fmt.Sprintf("`%s`", f)
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Errorf("invalid time format `%s` must be one of: %s", s, formatsString)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type name for time.Time flags.
|
||||||
|
func (d *timeValue) Type() string {
|
||||||
|
return "time"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *timeValue) String() string { return d.Time.Format(time.RFC3339Nano) }
|
||||||
|
|
||||||
|
// GetTime return the time value of a flag with the given name
|
||||||
|
func (f *FlagSet) GetTime(name string) (time.Time, error) {
|
||||||
|
flag := f.Lookup(name)
|
||||||
|
if flag == nil {
|
||||||
|
err := fmt.Errorf("flag accessed but not defined: %s", name)
|
||||||
|
return time.Time{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if flag.Value.Type() != "time" {
|
||||||
|
err := fmt.Errorf("trying to get %s value of flag of type %s", "time", flag.Value.Type())
|
||||||
|
return time.Time{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
val, ok := flag.Value.(*timeValue)
|
||||||
|
if !ok {
|
||||||
|
return time.Time{}, fmt.Errorf("value %s is not a time", flag.Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return *val.Time, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeVar defines a time.Time flag with specified name, default value, and usage string.
|
||||||
|
// The argument p points to a time.Time variable in which to store the value of the flag.
|
||||||
|
func (f *FlagSet) TimeVar(p *time.Time, name string, value time.Time, formats []string, usage string) {
|
||||||
|
f.TimeVarP(p, name, "", value, formats, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeVarP is like TimeVar, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func (f *FlagSet) TimeVarP(p *time.Time, name, shorthand string, value time.Time, formats []string, usage string) {
|
||||||
|
f.VarP(newTimeValue(value, p, formats), name, shorthand, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeVar defines a time.Time flag with specified name, default value, and usage string.
|
||||||
|
// The argument p points to a time.Time variable in which to store the value of the flag.
|
||||||
|
func TimeVar(p *time.Time, name string, value time.Time, formats []string, usage string) {
|
||||||
|
CommandLine.TimeVarP(p, name, "", value, formats, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeVarP is like TimeVar, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func TimeVarP(p *time.Time, name, shorthand string, value time.Time, formats []string, usage string) {
|
||||||
|
CommandLine.VarP(newTimeValue(value, p, formats), name, shorthand, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Time defines a time.Time flag with specified name, default value, and usage string.
|
||||||
|
// The return value is the address of a time.Time variable that stores the value of the flag.
|
||||||
|
func (f *FlagSet) Time(name string, value time.Time, formats []string, usage string) *time.Time {
|
||||||
|
return f.TimeP(name, "", value, formats, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeP is like Time, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func (f *FlagSet) TimeP(name, shorthand string, value time.Time, formats []string, usage string) *time.Time {
|
||||||
|
p := new(time.Time)
|
||||||
|
f.TimeVarP(p, name, shorthand, value, formats, usage)
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
// Time defines a time.Time flag with specified name, default value, and usage string.
|
||||||
|
// The return value is the address of a time.Time variable that stores the value of the flag.
|
||||||
|
func Time(name string, value time.Time, formats []string, usage string) *time.Time {
|
||||||
|
return CommandLine.TimeP(name, "", value, formats, usage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeP is like Time, but accepts a shorthand letter that can be used after a single dash.
|
||||||
|
func TimeP(name, shorthand string, value time.Time, formats []string, usage string) *time.Time {
|
||||||
|
return CommandLine.TimeP(name, shorthand, value, formats, usage)
|
||||||
|
}
|
||||||
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
|
|
@ -55,7 +55,7 @@ github.com/go-openapi/analysis/internal/flatten/sortref
|
||||||
# github.com/go-openapi/errors v0.22.2
|
# github.com/go-openapi/errors v0.22.2
|
||||||
## explicit; go 1.20
|
## explicit; go 1.20
|
||||||
github.com/go-openapi/errors
|
github.com/go-openapi/errors
|
||||||
# github.com/go-openapi/jsonpointer v0.21.1
|
# github.com/go-openapi/jsonpointer v0.21.2
|
||||||
## explicit; go 1.20
|
## explicit; go 1.20
|
||||||
github.com/go-openapi/jsonpointer
|
github.com/go-openapi/jsonpointer
|
||||||
# github.com/go-openapi/jsonreference v0.21.0
|
# github.com/go-openapi/jsonreference v0.21.0
|
||||||
|
|
@ -160,7 +160,7 @@ github.com/mattn/go-isatty
|
||||||
# github.com/mattn/go-runewidth v0.0.16
|
# github.com/mattn/go-runewidth v0.0.16
|
||||||
## explicit; go 1.9
|
## explicit; go 1.9
|
||||||
github.com/mattn/go-runewidth
|
github.com/mattn/go-runewidth
|
||||||
# github.com/mattn/go-sqlite3 v1.14.28
|
# github.com/mattn/go-sqlite3 v1.14.31
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
github.com/mattn/go-sqlite3
|
github.com/mattn/go-sqlite3
|
||||||
# github.com/minio/sio v0.4.1
|
# github.com/minio/sio v0.4.1
|
||||||
|
|
@ -223,7 +223,7 @@ github.com/rivo/uniseg
|
||||||
# github.com/spf13/cobra v1.9.1
|
# github.com/spf13/cobra v1.9.1
|
||||||
## explicit; go 1.15
|
## explicit; go 1.15
|
||||||
github.com/spf13/cobra
|
github.com/spf13/cobra
|
||||||
# github.com/spf13/pflag v1.0.6
|
# github.com/spf13/pflag v1.0.7
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
github.com/spf13/pflag
|
github.com/spf13/pflag
|
||||||
# github.com/stretchr/objx v0.5.2
|
# github.com/stretchr/objx v0.5.2
|
||||||
|
|
|
||||||
2
webapp/.env.development
Normal file
2
webapp/.env.development
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
VITE_GARM_API_URL=http://localhost:9997
|
||||||
|
NODE_ENV=development
|
||||||
8
webapp/.env.example
Normal file
8
webapp/.env.example
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Development Environment Variables
|
||||||
|
|
||||||
|
# GARM Backend API URL (for development only)
|
||||||
|
# When set, the frontend will connect to this URL instead of using proxy
|
||||||
|
# VITE_GARM_API_URL=http://localhost:9997
|
||||||
|
|
||||||
|
# Node Environment (automatically set by npm scripts)
|
||||||
|
# NODE_ENV=development
|
||||||
79
webapp/DEV_SETUP.md
Normal file
79
webapp/DEV_SETUP.md
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
# Development Setup
|
||||||
|
|
||||||
|
The web app can be started with the `npm run dev` command, which will start a development server with hot reloading. To properly work, there are a number of prerequisites you need to have and some GARM settings to tweak.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
To have a full development setup, you will need the following prerequisites:
|
||||||
|
|
||||||
|
- **Node.js 24+** and **npm**
|
||||||
|
- **Go 1.24+** (for building the GARM backend)
|
||||||
|
- **openapi-generator-cli** in your PATH (for API client generation)
|
||||||
|
|
||||||
|
The `openapi-generator-cli` will also need java to be installed. If you're running on Ubuntu, running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install default-jre
|
||||||
|
```
|
||||||
|
|
||||||
|
should be enough. Different distros should have an equivalent package available.
|
||||||
|
|
||||||
|
>[!NOTE]
|
||||||
|
>If you don't need to change the web app, you don't need to rebuild it. There is already a pre-built version in the repo.
|
||||||
|
|
||||||
|
## Necessary GARM settings
|
||||||
|
|
||||||
|
GARM has strict origin checks for websockets and API calls. To allow your local development server to communicate with the GARM backend, you need to configure the following settings:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[apiserver]
|
||||||
|
cors_origins = ["https://garm.example.com", "http://127.0.0.1:5173"]
|
||||||
|
```
|
||||||
|
|
||||||
|
>[!IMPORTANT]
|
||||||
|
> You must include the port.
|
||||||
|
|
||||||
|
>[!IMPORTANT]
|
||||||
|
> Omitting the `cors_origins` option will automatically check same host origin.
|
||||||
|
|
||||||
|
## Development Server
|
||||||
|
|
||||||
|
Your GARM server can be started and hosted anywhere. As long as you set the proper `cors_origins` URLs, your web-ui development server can be separate from your GARM server. To point the web app to the GARM server, you will need to create an `.env.development` file in the `webapp/` directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /home/ubuntu/garm/webapp
|
||||||
|
echo "VITE_GARM_API_URL=http://localhost:9997" > .env
|
||||||
|
echo "NODE_ENV=development" >> .env
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## Asset Management
|
||||||
|
|
||||||
|
During development:
|
||||||
|
- SVG icons are served from `static/assets/`
|
||||||
|
- Favicons are served from `static/`
|
||||||
|
- All static assets are copied from `assets/assets/` to `static/assets/`
|
||||||
|
|
||||||
|
## Building for Production
|
||||||
|
|
||||||
|
For production deployments, the web app is embedded into the GARM binary. You don't need to serve it separately. To build the web app and embed it into the binary, run the following 2 commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build the static webapp
|
||||||
|
make build-webui
|
||||||
|
# Build the garm binary with the webapp embedded
|
||||||
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
This creates the production build with:
|
||||||
|
- Base path set to `/ui`
|
||||||
|
- All assets embedded for Go to serve
|
||||||
|
- Optimized bundles
|
||||||
|
|
||||||
|
>[!IMPORTANT]
|
||||||
|
>The web UI is an optional feature in GARM. For the `/ui` URL to be available, you will need to enable it in the garm config file under:
|
||||||
|
>```toml
|
||||||
|
>[apiserver.webui]
|
||||||
|
> enable=true
|
||||||
|
>```
|
||||||
|
>See the sample config file in the `testdata/config.toml` file.
|
||||||
102
webapp/README.md
Normal file
102
webapp/README.md
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
# GARM SPA (SvelteKit)
|
||||||
|
|
||||||
|
This is a Single Page Application (SPA) implementation of the GARM web interface using SvelteKit.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Lightweight**: Uses SvelteKit for minimal bundle size and fast performance
|
||||||
|
- **Modern**: TypeScript-first development with full type safety
|
||||||
|
- **Responsive**: Mobile-first design using Tailwind CSS
|
||||||
|
- **Real-time**: WebSocket integration for live updates
|
||||||
|
- **API-driven**: Uses the existing GARM REST API endpoints
|
||||||
|
|
||||||
|
### Quick Start
|
||||||
|
|
||||||
|
1. **Clone the repository** (if not already done)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/cloudbase/garm.git
|
||||||
|
cd garm
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Build and test GARM with embedded webapp**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# You can skip this command if you made no changes to the webapp.
|
||||||
|
make build-webui
|
||||||
|
# builds the binary, with the web UI embedded.
|
||||||
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure you enable the webui in the config:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[apiserver.webui]
|
||||||
|
enable=true
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Access the webapp**
|
||||||
|
- Navigate to `http://localhost:9997/ui/` (or your configured fqdn and port)
|
||||||
|
|
||||||
|
### Development Workflow
|
||||||
|
|
||||||
|
See the [DEV_SETUP.md](DEV_SETUP.md) file.
|
||||||
|
|
||||||
|
### Git Workflow
|
||||||
|
|
||||||
|
**DO NOT commit** the following directories:
|
||||||
|
- `webapp/node_modules/` - Dependencies (managed by package-lock.json)
|
||||||
|
- `webapp/.svelte-kit/` - Build cache and generated files
|
||||||
|
- `webapp/build/` - Production build output
|
||||||
|
|
||||||
|
These are already included in `.gitignore`. Only commit source files in `webapp/src/` and configuration files.
|
||||||
|
|
||||||
|
### API Client Generation
|
||||||
|
|
||||||
|
The webapp uses auto-generated TypeScript clients from the GARM OpenAPI spec using `go generate`. To regenerate the clients, mocks and everything else, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go generate ./...
|
||||||
|
```
|
||||||
|
|
||||||
|
In the root folder of the project.
|
||||||
|
|
||||||
|
>[!NOTE]
|
||||||
|
> See [DEV_SETUP.md](DEV_SETUP.md) for prerequisites, before you try to generate the files.
|
||||||
|
|
||||||
|
### Asset Serving
|
||||||
|
|
||||||
|
The webapp is embedded using Go's `embed` package in `webapp/assets/assets.go`:
|
||||||
|
|
||||||
|
```go
|
||||||
|
//go:embed all:*
|
||||||
|
var EmbeddedSPA embed.FS
|
||||||
|
```
|
||||||
|
|
||||||
|
This allows GARM to serve the entire webapp with zero external dependencies. The webapp assets are compiled into the Go binary at build time.
|
||||||
|
|
||||||
|
## Running GARM behind a reverse proxy
|
||||||
|
|
||||||
|
In production, GARM will serve the web UI and assets from the embedded files inside the binary. The web UI also relies on the [events](/doc/events.md) API for real-time updates.
|
||||||
|
|
||||||
|
To have a fully working experience, you will need to configure your reverse proxy to allow websocket upgrades. For an `nginx` example, see [the sample config in the testdata folder](/testdata/nginx-server.conf).
|
||||||
|
|
||||||
|
Additionally, in production you can also override the default web UI that is embedded in GARM, without updating the garm binary. To do that, build the webapp, place it in the document root of `nginx` and create a new `location /ui` config in nginx. Something like the following should work:
|
||||||
|
|
||||||
|
```
|
||||||
|
# Place this before the proxy_pass location
|
||||||
|
location ~ ^/ui(/.*)?$ {
|
||||||
|
root /var/www/html/garm-webui/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Host $http_host;
|
||||||
|
|
||||||
|
proxy_pass http://garm_backend;
|
||||||
|
proxy_set_header Host $Host;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This should allow you to override the default web UI embedded in GARM without updating the GARM binary.
|
||||||
1
webapp/assets/_app/env.js
Normal file
1
webapp/assets/_app/env.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export const env={}
|
||||||
1
webapp/assets/_app/immutable/assets/0.BPrCR_r7.css
Normal file
1
webapp/assets/_app/immutable/assets/0.BPrCR_r7.css
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/assets/_layout.BPrCR_r7.css
Normal file
1
webapp/assets/_app/immutable/assets/_layout.BPrCR_r7.css
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/chunks/5WA7h8uK.js
Normal file
1
webapp/assets/_app/immutable/chunks/5WA7h8uK.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{M as K,K as T,L as j,N as C,_ as F,a0 as q,a1 as $,Y as z,a2 as x,O as G,P as A,Q as H,at as J,R as Z,aa as Q,U as V,T as W,au as D,m as X,av as k,s as U,J as ee,g as m,aw as re,ax as ne,ay as w,az as se,aA as M,ar as ae,q as ie,aB as te,aj as R,aC as ue,a6 as fe,aD as le,u as oe,aE as ce,aF as de,aG as _e,aH as N,aI as L,aJ as pe,aK as ve,S as Y,aL as B,aM as S}from"./D8EpLgQ1.js";function Ie(e,r,s=!1){T&&j();var n=e,a=null,i=null,l=J,d=s?C:0,p=!1;const P=(o,u=!0)=>{p=!0,_(u,o)};var f=null;function I(){f!==null&&(f.lastChild.remove(),n.before(f),f=null);var o=l?a:i,u=l?i:a;o&&Q(o),u&&V(u,()=>{l?i=null:a=null})}const _=(o,u)=>{if(l===(l=o))return;let g=!1;if(T){const E=F(n)===q;!!l===E&&(n=$(),z(n),x(!1),g=!0)}var b=Z(),c=n;if(b&&(f=document.createDocumentFragment(),f.append(c=G())),l?a??=u&&A(()=>u(c)):i??=u&&A(()=>u(c)),b){var h=H,t=l?a:i,v=l?i:a;t&&h.skipped_effects.delete(t),v&&h.skipped_effects.add(v),h.add_callback(I)}else I();g&&x(!0)};K(()=>{p=!1,r(P),p||_(null,null)},d),T&&(n=W)}let O=!1,y=Symbol();function ge(e,r,s){const n=s[r]??={store:null,source:X(void 0),unsubscribe:D};if(n.store!==e&&!(y in s))if(n.unsubscribe(),n.store=e??null,e==null)n.source.v=void 0,n.unsubscribe=D;else{var a=!0;n.unsubscribe=k(e,i=>{a?n.source.v=i:U(n.source,i)}),a=!1}return e&&y in s?ee(e):m(n.source)}function Ee(){const e={};function r(){re(()=>{for(var s in e)e[s].unsubscribe();ne(e,y,{enumerable:!1,value:!0})})}return[e,r]}function be(e){var r=O;try{return O=!1,[e(),O]}finally{O=r}}const he={get(e,r){if(!e.exclude.includes(r))return m(e.version),r in e.special?e.special[r]():e.props[r]},set(e,r,s){if(!(r in e.special)){var n=R;try{L(e.parent_effect),e.special[r]=me({get[r](){return e.props[r]}},r,M)}finally{L(n)}}return e.special[r](s),N(e.version),!0},getOwnPropertyDescriptor(e,r){if(!e.exclude.includes(r)&&r in e.props)return{enumerable:!0,configurable:!0,value:e.props[r]}},deleteProperty(e,r){return e.exclude.includes(r)||(e.exclude.push(r),N(e.version)),!0},has(e,r){return e.exclude.includes(r)?!1:r in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(r=>!e.exclude.includes(r))}};function Oe(e,r){return new Proxy({props:e,exclude:r,special:{},version:fe(0),parent_effect:R},he)}const Se={get(e,r){let s=e.props.length;for(;s--;){let n=e.props[s];if(S(n)&&(n=n()),typeof n=="object"&&n!==null&&r in n)return n[r]}},set(e,r,s){let n=e.props.length;for(;n--;){let a=e.props[n];S(a)&&(a=a());const i=w(a,r);if(i&&i.set)return i.set(s),!0}return!1},getOwnPropertyDescriptor(e,r){let s=e.props.length;for(;s--;){let n=e.props[s];if(S(n)&&(n=n()),typeof n=="object"&&n!==null&&r in n){const a=w(n,r);return a&&!a.configurable&&(a.configurable=!0),a}}},has(e,r){if(r===Y||r===B)return!1;for(let s of e.props)if(S(s)&&(s=s()),s!=null&&r in s)return!0;return!1},ownKeys(e){const r=[];for(let s of e.props)if(S(s)&&(s=s()),!!s){for(const n in s)r.includes(n)||r.push(n);for(const n of Object.getOwnPropertySymbols(s))r.includes(n)||r.push(n)}return r}};function Te(...e){return new Proxy({props:e},Se)}function me(e,r,s,n){var a=!ce||(s&de)!==0,i=(s&le)!==0,l=(s&pe)!==0,d=n,p=!0,P=()=>(p&&(p=!1,d=l?oe(n):n),d),f;if(i){var I=Y in e||B in e;f=w(e,r)?.set??(I&&r in e?t=>e[r]=t:void 0)}var _,o=!1;i?[_,o]=be(()=>e[r]):_=e[r],_===void 0&&n!==void 0&&(_=P(),f&&(a&&se(),f(_)));var u;if(a?u=()=>{var t=e[r];return t===void 0?P():(p=!0,t)}:u=()=>{var t=e[r];return t!==void 0&&(d=void 0),t===void 0?d:t},a&&(s&M)===0)return u;if(f){var g=e.$$legacy;return function(t,v){return arguments.length>0?((!a||!v||g||o)&&f(v?u():t),t):u()}}var b=!1,c=((s&_e)!==0?ae:ie)(()=>(b=!1,u()));i&&m(c);var h=R;return function(t,v){if(arguments.length>0){const E=v?m(c):a&&i?te(t):t;return U(c,E),b=!0,d!==void 0&&(d=E),t}return ve&&b||(h.f&ue)!==0?c.v:m(c)}}export{ge as a,Te as b,Ie as i,Oe as l,me as p,Ee as s};
|
||||||
1
webapp/assets/_app/immutable/chunks/B3Pzt0F_.js
Normal file
1
webapp/assets/_app/immutable/chunks/B3Pzt0F_.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{am as g,an as d,ao as c,u as m,ap as b,aq as i,g as p,n as v,ar as h,as as k}from"./D8EpLgQ1.js";function x(n=!1){const s=g,e=s.l.u;if(!e)return;let f=()=>v(s.s);if(n){let t=0,a={};const _=h(()=>{let l=!1;const r=s.s;for(const o in r)r[o]!==a[o]&&(a[o]=r[o],l=!0);return l&&t++,t});f=()=>p(_)}e.b.length&&d(()=>{u(s,f),i(e.b)}),c(()=>{const t=m(()=>e.m.map(b));return()=>{for(const a of t)typeof a=="function"&&a()}}),e.a.length&&c(()=>{u(s,f),i(e.a)})}function u(n,s){if(n.l.s)for(const e of n.l.s)p(e);s()}k();export{x as i};
|
||||||
1
webapp/assets/_app/immutable/chunks/B7ITzBt8.js
Normal file
1
webapp/assets/_app/immutable/chunks/B7ITzBt8.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as j}from"./B3Pzt0F_.js";import{p as R,l as w,a as q,f as g,t as v,c as k,d as A,k as B,j as u,s as _,m as y,r as m,n as f,u as b,g as d,v as h}from"./D8EpLgQ1.js";import{p as o,i as D}from"./5WA7h8uK.js";import{c as U,s as F}from"./CiE1LlKV.js";import{b as r}from"./CoIRRsD9.js";var G=g('<div class="text-sm text-gray-500 dark:text-gray-400 truncate"> </div>'),H=g('<div class="w-full min-w-0 text-sm font-medium"><a> </a> <!></div>');function V(x,n){R(n,!1);const i=y(),p=y();let e=o(n,"item",8),s=o(n,"entityType",8,"repository"),$=o(n,"showOwner",8,!1),E=o(n,"showId",8,!1),I=o(n,"fontMono",8,!1);function z(){if(!e())return"Unknown";switch(s()){case"repository":return $()?`${e().owner||"Unknown"}/${e().name||"Unknown"}`:e().name||"Unknown";case"organization":case"enterprise":return e().name||"Unknown";case"pool":return E()?e().id||"Unknown":e().name||"Unknown";case"scaleset":return e().name||"Unknown";case"instance":return e().name||"Unknown";default:return e().name||e().id||"Unknown"}}function C(){if(!e())return"#";let t;switch(s()){case"instance":t=e().name;break;default:t=e().id||e().name;break}if(!t)return"#";switch(s()){case"repository":return`${r}/repositories/${t}`;case"organization":return`${r}/organizations/${t}`;case"enterprise":return`${r}/enterprises/${t}`;case"pool":return`${r}/pools/${t}`;case"scaleset":return`${r}/scalesets/${t}`;case"instance":return`${r}/instances/${encodeURIComponent(t)}`;default:return"#"}}w(()=>{},()=>{_(i,z())}),w(()=>{},()=>{_(p,C())}),q(),j();var c=H(),a=u(c),M=u(a,!0);m(a);var N=B(a,2);{var O=t=>{var l=G(),T=u(l,!0);m(l),v(()=>h(T,(f(e()),b(()=>e().provider_id)))),k(t,l)};D(N,t=>{f(s()),f(e()),b(()=>s()==="instance"&&e()?.provider_id)&&t(O)})}m(c),v(()=>{U(a,"href",d(p)),F(a,1,`block w-full truncate text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 ${I()?"font-mono":""}`),U(a,"title",d(i)),h(M,d(i))}),k(x,c),A()}export{V as E};
|
||||||
1
webapp/assets/_app/immutable/chunks/BAg1iRPq.js
Normal file
1
webapp/assets/_app/immutable/chunks/BAg1iRPq.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{F as t,G as S,u as b,H as h,S as k}from"./D8EpLgQ1.js";function u(r,i){return r===i||r?.[k]===i}function d(r={},i,a,T){return t(()=>{var f,s;return S(()=>{f=s,s=[],b(()=>{r!==a(...s)&&(i(r,...s),f&&u(a(...f),r)&&i(null,...f))})}),()=>{h(()=>{s&&u(a(...s),r)&&i(null,...s)})}}),r}export{d as b};
|
||||||
1
webapp/assets/_app/immutable/chunks/BE4wujub.js
Normal file
1
webapp/assets/_app/immutable/chunks/BE4wujub.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as v}from"./B3Pzt0F_.js";import{p as w,l as m,n as s,g as r,m as g,a as x,B as h,b as T,c as B,d as S,s as k,u}from"./D8EpLgQ1.js";import{k as A}from"./C9DJVOi1.js";import{p as d}from"./5WA7h8uK.js";import{k as b,B as C}from"./BGVHQGl-.js";import{f as E}from"./ow_oMtSd.js";function q(_,i){w(i,!1);const c=g(),n=g();let e=d(i,"item",8),l=d(i,"statusType",8,"entity"),a=d(i,"statusField",8,"status");m(()=>(s(e()),s(a())),()=>{k(c,e()?.[a()]||"unknown")}),m(()=>(s(e()),s(l()),r(c),s(a())),()=>{k(n,(()=>{if(!e())return{variant:"error",text:"Unknown"};switch(l()){case"entity":return b(e());case"instance":let t="secondary";switch(r(c).toLowerCase()){case"running":t="success";break;case"stopped":t="info";break;case"creating":case"pending_create":t="warning";break;case"deleting":case"pending_delete":case"pending_force_delete":t="warning";break;case"error":case"deleted":t="error";break;case"active":case"online":t="success";break;case"idle":t="info";break;case"pending":case"installing":t="warning";break;case"failed":case"terminated":case"offline":t="error";break;case"unknown":default:t="secondary";break}return{variant:t,text:E(r(c))};case"enabled":return{variant:e().enabled?"success":"error",text:e().enabled?"Enabled":"Disabled"};case"custom":const o=e()[a()]||"Unknown";if(a()==="auth-type"){const f=o==="pat"||!o?"pat":"app";return{variant:f==="pat"?"success":"info",text:f==="pat"?"PAT":"App"}}return{variant:"info",text:o};default:return b(e())}})())}),x(),v();var p=h(),y=T(p);A(y,()=>(s(e()),s(a()),u(()=>`${e()?.name||"item"}-${e()?.[a()]||"status"}-${e()?.updated_at||"time"}`)),t=>{C(t,{get variant(){return r(n),u(()=>r(n).variant)},get text(){return r(n),u(()=>r(n).text)}})}),B(_,p),S()}export{q as S};
|
||||||
1
webapp/assets/_app/immutable/chunks/BEkVdVE1.js
Normal file
1
webapp/assets/_app/immutable/chunks/BEkVdVE1.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{I as u}from"./D8EpLgQ1.js";function c(){const{subscribe:s,set:i,update:o}=u([]),n={subscribe:s,add:e=>{const t=Math.random().toString(36).substr(2,9),r={...e,id:t,duration:e.duration??5e3};return o(a=>[...a,r]),r.duration&&r.duration>0&&setTimeout(()=>{o(a=>a.filter(d=>d.id!==t))},r.duration),t},remove:e=>{o(t=>t.filter(r=>r.id!==e))},clear:()=>{i([])},success:(e,t="",r)=>n.add({type:"success",title:e,message:t,duration:r}),error:(e,t="",r)=>n.add({type:"error",title:e,message:t,duration:r}),info:(e,t="",r)=>n.add({type:"info",title:e,message:t,duration:r}),warning:(e,t="",r)=>n.add({type:"warning",title:e,message:t,duration:r})};return n}const p=c();export{p as t};
|
||||||
4
webapp/assets/_app/immutable/chunks/BGVHQGl-.js
Normal file
4
webapp/assets/_app/immutable/chunks/BGVHQGl-.js
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as m}from"./B3Pzt0F_.js";import{p as w,l as x,n as d,a as k,f as _,t as b,c as v,d as y,s as h,m as E,j as B,r as z,g as L,v as M}from"./D8EpLgQ1.js";import{s as j,e as $}from"./CiE1LlKV.js";import{p as o}from"./5WA7h8uK.js";function S(e){if(!e)return"N/A";try{return(typeof e=="string"?new Date(e):e).toLocaleString()}catch{return"Invalid Date"}}function A(e,r="w-4 h-4"){return e==="gitea"?`<svg class="${r}" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 640 640"><path d="m395.9 484.2-126.9-61c-12.5-6-17.9-21.2-11.8-33.8l61-126.9c6-12.5 21.2-17.9 33.8-11.8 17.2 8.3 27.1 13 27.1 13l-.1-109.2 16.7-.1.1 117.1s57.4 24.2 83.1 40.1c3.7 2.3 10.2 6.8 12.9 14.4 2.1 6.1 2 13.1-1 19.3l-61 126.9c-6.2 12.7-21.4 18.1-33.9 12" style="fill:#fff"/><path d="M622.7 149.8c-4.1-4.1-9.6-4-9.6-4s-117.2 6.6-177.9 8c-13.3.3-26.5.6-39.6.7v117.2c-5.5-2.6-11.1-5.3-16.6-7.9 0-36.4-.1-109.2-.1-109.2-29 .4-89.2-2.2-89.2-2.2s-141.4-7.1-156.8-8.5c-9.8-.6-22.5-2.1-39 1.5-8.7 1.8-33.5 7.4-53.8 26.9C-4.9 212.4 6.6 276.2 8 285.8c1.7 11.7 6.9 44.2 31.7 72.5 45.8 56.1 144.4 54.8 144.4 54.8s12.1 28.9 30.6 55.5c25 33.1 50.7 58.9 75.7 62 63 0 188.9-.1 188.9-.1s12 .1 28.3-10.3c14-8.5 26.5-23.4 26.5-23.4S547 483 565 451.5c5.5-9.7 10.1-19.1 14.1-28 0 0 55.2-117.1 55.2-231.1-1.1-34.5-9.6-40.6-11.6-42.6M125.6 353.9c-25.9-8.5-36.9-18.7-36.9-18.7S69.6 321.8 60 295.4c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5 38.5-30c13.8-3.7 31-3.1 31-3.1s7.1 59.4 15.7 94.2c7.2 29.2 24.8 77.7 24.8 77.7s-26.1-3.1-43-9.1m300.3 107.6s-6.1 14.5-19.6 15.4c-5.8.4-10.3-1.2-10.3-1.2s-.3-.1-5.3-2.1l-112.9-55s-10.9-5.7-12.8-15.6c-2.2-8.1 2.7-18.1 2.7-18.1L322 273s4.8-9.7 12.2-13c.6-.3 2.3-1 4.5-1.5 8.1-2.1 18 2.8 18 2.8L467.4 315s12.6 5.7 15.3 16.2c1.9 7.4-.5 14-1.8 17.2-6.3 15.4-55 113.1-55 113.1" style="fill:#609926"/><path d="M326.8 380.1c-8.2.1-15.4 5.8-17.3 13.8s2 16.3 9.1 20c7.7 4 17.5 1.8 22.7-5.4 5.1-7.1 4.3-16.9-1.8-23.1l24-49.1c1.5.1 3.7.2 6.2-.5 4.1-.9 7.1-3.6 7.1-3.6 4.2 1.8 8.6 3.8 13.2 6.1 4.8 2.4 9.3 4.9 13.4 7.3.9.5 1.8 1.1 2.8 1.9 1.6 1.3 3.4 3.1 4.7 5.5 1.9 5.5-1.9 14.9-1.9 14.9-2.3 7.6-18.4 40.6-18.4 40.6-8.1-.2-15.3 5-17.7 12.5-2.6 8.1 1.1 17.3 8.9 21.3s17.4 1.7 22.5-5.3c5-6.8 4.6-16.3-1.1-22.6 1.9-3.7 3.7-7.4 5.6-11.3 5-10.4 13.5-30.4 13.5-30.4.9-1.7 5.7-10.3 2.7-21.3-2.5-11.4-12.6-16.7-12.6-16.7-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3 4.7-9.7 9.4-19.3 14.1-29-4.1-2-8.1-4-12.2-6.1-4.8 9.8-9.7 19.7-14.5 29.5-6.7-.1-12.9 3.5-16.1 9.4-3.4 6.3-2.7 14.1 1.9 19.8z" style="fill:#609926"/></svg>`:e==="github"?`<div class="inline-flex ${r}"><svg class="${r} dark:hidden" width="98" height="96" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 96"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#24292f"/></svg><svg class="${r} hidden dark:block" width="98" height="96" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 96"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#fff"/></svg></div>`:`<svg class="${r} text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||||
|
</svg>`}function C(e,r){if(e.repo_name)return e.repo_name;if(e.org_name)return e.org_name;if(e.enterprise_name)return e.enterprise_name;if(e.repo_id&&!e.repo_name&&r?.repositories){const n=r.repositories.find(t=>t.id===e.repo_id);return n?`${n.owner}/${n.name}`:"Unknown Entity"}if(e.org_id&&!e.org_name&&r?.organizations){const n=r.organizations.find(t=>t.id===e.org_id);return n&&n.name?n.name:"Unknown Entity"}if(e.enterprise_id&&!e.enterprise_name&&r?.enterprises){const n=r.enterprises.find(t=>t.id===e.enterprise_id);return n&&n.name?n.name:"Unknown Entity"}return"Unknown Entity"}function H(e){return e.repo_id?"repository":e.org_id?"organization":e.enterprise_id?"enterprise":"unknown"}function P(e,r=""){return e.repo_id?`${r}/repositories/${e.repo_id}`:e.org_id?`${r}/organizations/${e.org_id}`:e.enterprise_id?`${r}/enterprises/${e.enterprise_id}`:"#"}function V(e){e&&(e.scrollTop=e.scrollHeight)}function W(e){return{newPerPage:e,newCurrentPage:1}}function q(e){return e.pool_manager_status?.running?{text:"Running",variant:"success"}:{text:"Stopped",variant:"error"}}function G(e){switch(e.toLowerCase()){case"error":return{text:"Error",variant:"error"};case"warning":return{text:"Warning",variant:"warning"};case"info":return{text:"Info",variant:"info"};default:return{text:e,variant:"info"}}}function l(e,r,n){if(!r.trim())return e;const t=r.toLowerCase();return e.filter(a=>typeof n=="function"?n(a).toLowerCase().includes(t):n.some(i=>a[i]?.toString().toLowerCase().includes(t)))}function J(e,r){return l(e,r,["name","owner"])}function K(e,r){return l(e,r,["name"])}function O(e,r){return l(e,r,n=>[n.name||"",n.description||"",n.endpoint?.name||""].join(" "))}function Q(e,r){return l(e,r,["name","description","base_url","api_base_url"])}function X(e,r,n){return e.slice((r-1)*n,r*n)}var T=_("<span> </span>");function Y(e,r){w(r,!1);const n=E();let t=o(r,"variant",8,"gray"),a=o(r,"size",8,"sm"),i=o(r,"text",8),g=o(r,"ring",8,!1);const c={success:"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200",error:"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200",warning:"bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200",info:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200",gray:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200",blue:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200",green:"bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200",red:"bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200",yellow:"bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200",secondary:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200"},u={success:"ring-green-600/20 dark:ring-green-400/30",error:"ring-red-600/20 dark:ring-red-400/30",warning:"ring-yellow-600/20 dark:ring-yellow-400/30",info:"ring-blue-600/20 dark:ring-blue-400/30",gray:"ring-gray-500/20 dark:ring-gray-400/30",blue:"ring-blue-600/20 dark:ring-blue-400/30",green:"ring-green-600/20 dark:ring-green-400/30",red:"ring-red-600/20 dark:ring-red-400/30",yellow:"ring-yellow-600/20 dark:ring-yellow-400/30",secondary:"ring-gray-500/20 dark:ring-gray-400/30"},f={sm:"px-2 py-1 text-xs",md:"px-2.5 py-0.5 text-xs"};x(()=>(d(t()),d(a()),d(g())),()=>{h(n,["inline-flex items-center rounded-full font-semibold",c[t()],f[a()],g()?`ring-1 ring-inset ${u[t()]}`:""].filter(Boolean).join(" "))}),k(),m();var s=T(),p=B(s,!0);z(s),b(()=>{j(s,1,$(L(n))),M(p,i())}),v(e,s),y()}export{Y as B,Q as a,S as b,W as c,G as d,C as e,O as f,A as g,l as h,H as i,P as j,q as k,K as l,J as m,X as p,V as s};
|
||||||
1
webapp/assets/_app/immutable/chunks/BmGWMSQm.js
Normal file
1
webapp/assets/_app/immutable/chunks/BmGWMSQm.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/chunks/C41YH50Q.js
Normal file
1
webapp/assets/_app/immutable/chunks/C41YH50Q.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{s as e}from"./CTf6mQoE.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p};
|
||||||
1
webapp/assets/_app/immutable/chunks/C6k1Q4We.js
Normal file
1
webapp/assets/_app/immutable/chunks/C6k1Q4We.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{V as b,W as o,u as h,G as _,K as t,Q as f,X as m}from"./D8EpLgQ1.js";function y(e,a,c=a){var v=b(),d=new WeakSet;o(e,"input",r=>{var l=r?e.defaultValue:e.value;if(l=n(e)?s(l):l,c(l),f!==null&&d.add(f),v&&l!==(l=a())){var k=e.selectionStart,u=e.selectionEnd;e.value=l??"",u!==null&&(e.selectionStart=k,e.selectionEnd=Math.min(u,e.value.length))}}),(t&&e.defaultValue!==e.value||h(a)==null&&e.value)&&(c(n(e)?s(e.value):e.value),f!==null&&d.add(f)),_(()=>{var r=a();if(e===document.activeElement){var l=m??f;if(d.has(l))return}n(e)&&r===s(e.value)||e.type==="date"&&!r&&!e.value||r!==e.value&&(e.value=r??"")})}function E(e,a,c=a){o(e,"change",v=>{var d=v?e.defaultChecked:e.checked;c(d)}),(t&&e.defaultChecked!==e.checked||h(a)==null)&&c(e.checked),_(()=>{var v=a();e.checked=!!v})}function n(e){var a=e.type;return a==="number"||a==="range"}function s(e){return e===""?null:+e}export{E as a,y as b};
|
||||||
1
webapp/assets/_app/immutable/chunks/C89fcOde.js
Normal file
1
webapp/assets/_app/immutable/chunks/C89fcOde.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/chunks/C9DJVOi1.js
Normal file
1
webapp/assets/_app/immutable/chunks/C9DJVOi1.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/chunks/CCSWcuVN.js
Normal file
1
webapp/assets/_app/immutable/chunks/CCSWcuVN.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{K as l,L as u,M as m,N as _,O as p,P as h,Q as v,R as b,T,U as g}from"./D8EpLgQ1.js";function y(s,i,d){l&&u();var r=s,a,n,e=null,t=null;function f(){n&&(g(n),n=null),e&&(e.lastChild.remove(),r.before(e),e=null),n=t,t=null}m(()=>{if(a!==(a=i())){var c=b();if(a){var o=r;c&&(e=document.createDocumentFragment(),e.append(o=p())),t=h(()=>d(o,a))}c?v.add_callback(f):f()}},_),l&&(r=T)}export{y as c};
|
||||||
1
webapp/assets/_app/immutable/chunks/CGpPw4EW.js
Normal file
1
webapp/assets/_app/immutable/chunks/CGpPw4EW.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as _}from"./B3Pzt0F_.js";import{p as h,f as x,t as u,c as g,d as k,k as w,j as o,u as m,n as e,r,v as y}from"./D8EpLgQ1.js";import{h as b}from"./CiE1LlKV.js";import{p}from"./5WA7h8uK.js";import{g as v}from"./BGVHQGl-.js";var z=x('<div class="flex items-center"><div class="flex-shrink-0 mr-2"><!></div> <div class="text-sm text-gray-900 dark:text-white"> </div></div>');function U(l,i){h(i,!1);let t=p(i,"item",8),s=p(i,"iconSize",8,"w-5 h-5");_();var a=z(),n=o(a),f=o(n);b(f,()=>(e(v),e(t()),e(s()),m(()=>v(t()?.endpoint?.endpoint_type||t()?.endpoint_type||"unknown",s())))),r(n);var d=w(n,2),c=o(d,!0);r(d),r(a),u(()=>y(c,(e(t()),m(()=>t()?.endpoint?.name||t()?.endpoint_name||t()?.github_endpoint_name||"Unknown")))),g(l,a),k()}export{U as E};
|
||||||
1
webapp/assets/_app/immutable/chunks/CLYUNKnN.js
Normal file
1
webapp/assets/_app/immutable/chunks/CLYUNKnN.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as b}from"./B3Pzt0F_.js";import{p as k,f as E,t as C,u as i,n as t,v as n,c as j,d as P,k as z,j as l,r as o}from"./D8EpLgQ1.js";import{c as N}from"./CiE1LlKV.js";import{p as f}from"./5WA7h8uK.js";import"./CoIRRsD9.js";import{j as x,e as c,i as u}from"./BGVHQGl-.js";var T=E('<div class="flex flex-col"><a class="text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300"> </a> <span class="text-xs text-gray-500 dark:text-gray-400 capitalize"> </span></div>');function G(d,r){k(r,!1);let e=f(r,"item",8),m=f(r,"eagerCache",8,null);b();var s=T(),a=l(s),v=l(a,!0);o(a);var p=z(a,2),g=l(p,!0);o(p),o(s),C((h,y,_)=>{N(a,"href",h),n(v,y),n(g,_)},[()=>(t(x),t(e()),i(()=>x(e()))),()=>(t(c),t(e()),t(m()),i(()=>c(e(),m()))),()=>(t(u),t(e()),i(()=>u(e())))]),j(d,s),P()}export{G as P};
|
||||||
1
webapp/assets/_app/immutable/chunks/CNMHKIIK.js
Normal file
1
webapp/assets/_app/immutable/chunks/CNMHKIIK.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as j}from"./B3Pzt0F_.js";import{p as E,E as G,f as S,j as t,r,k as g,u,n as p,z as m,t as z,v as D,e as f,c as H,d as I}from"./D8EpLgQ1.js";import{h as y,s as v}from"./CiE1LlKV.js";import{p as h}from"./5WA7h8uK.js";import{g as o}from"./BGVHQGl-.js";var q=S('<fieldset><legend class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> </legend> <div class="grid grid-cols-2 gap-4"><button type="button"><!> <span class="mt-2 text-sm font-medium text-gray-900 dark:text-white">GitHub</span></button> <button type="button"><!> <span class="mt-2 text-sm font-medium text-gray-900 dark:text-white">Gitea</span></button></div></fieldset>');function M(x,s){E(s,!1);const k=G();let d=h(s,"selectedForgeType",12,""),_=h(s,"label",8,"Select Forge Type");function n(c){d(c),k("select",c)}j();var i=q(),l=t(i),F=t(l,!0);r(l);var b=g(l,2),e=t(b),w=t(e);y(w,()=>(p(o),u(()=>o("github","w-8 h-8")))),m(2),r(e);var a=g(e,2),T=t(a);y(T,()=>(p(o),u(()=>o("gitea","w-8 h-8")))),m(2),r(a),r(b),r(i),z(()=>{D(F,_()),v(e,1,`flex flex-col items-center justify-center p-6 border-2 rounded-lg transition-colors cursor-pointer ${d()==="github"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),v(a,1,`flex flex-col items-center justify-center p-6 border-2 rounded-lg transition-colors cursor-pointer ${d()==="gitea"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`)}),f("click",e,()=>n("github")),f("click",a,()=>n("gitea")),H(x,i),I()}export{M as F};
|
||||||
1
webapp/assets/_app/immutable/chunks/CO4LUyTP.js
Normal file
1
webapp/assets/_app/immutable/chunks/CO4LUyTP.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as E}from"./B3Pzt0F_.js";import{p as H,E as L,f as h,t as f,c,d as z,j as e,r as a,k as x,v as d,z as M,D as q}from"./D8EpLgQ1.js";import{p as i,i as C}from"./5WA7h8uK.js";import{B as F}from"./CiE1LlKV.js";var G=h('<div class="mt-4 sm:mt-0 flex items-center space-x-4"><!></div>'),I=h('<div class="sm:flex sm:items-center sm:justify-between"><div><h1 class="text-2xl font-bold text-gray-900 dark:text-white"> </h1> <p class="mt-2 text-sm text-gray-700 dark:text-gray-300"> </p></div> <!></div>');function S(u,t){H(t,!1);const _=L();let k=i(t,"title",8),b=i(t,"description",8),v=i(t,"actionLabel",8,null),g=i(t,"showAction",8,!0);function w(){_("action")}E();var r=I(),s=e(r),o=e(s),y=e(o,!0);a(o);var m=x(o,2),j=e(m,!0);a(m),a(s);var A=x(s,2);{var P=n=>{var l=G(),B=e(l);F(B,{variant:"primary",icon:'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />',$$events:{click:w},children:(D,J)=>{M();var p=q();f(()=>d(p,v())),c(D,p)},$$slots:{default:!0}}),a(l),c(n,l)};C(A,n=>{g()&&v()&&n(P)})}a(r),f(()=>{d(y,k()),d(j,b())}),c(u,r),z()}export{S as P};
|
||||||
3
webapp/assets/_app/immutable/chunks/CTf6mQoE.js
Normal file
3
webapp/assets/_app/immutable/chunks/CTf6mQoE.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/chunks/CclkODgu.js
Normal file
1
webapp/assets/_app/immutable/chunks/CclkODgu.js
Normal file
File diff suppressed because one or more lines are too long
7
webapp/assets/_app/immutable/chunks/CiE1LlKV.js
Normal file
7
webapp/assets/_app/immutable/chunks/CiE1LlKV.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/chunks/CoIRRsD9.js
Normal file
1
webapp/assets/_app/immutable/chunks/CoIRRsD9.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
const s=globalThis.__sveltekit_13hoftk?.base??"/ui",t=globalThis.__sveltekit_13hoftk?.assets??s;export{t as a,s as b};
|
||||||
1
webapp/assets/_app/immutable/chunks/CwqI2jFH.js
Normal file
1
webapp/assets/_app/immutable/chunks/CwqI2jFH.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/chunks/D4Caz1gY.js
Normal file
1
webapp/assets/_app/immutable/chunks/D4Caz1gY.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
function r(t){return function(...e){var n=e[0];return n.preventDefault(),t?.apply(this,e)}}export{r as p};
|
||||||
2
webapp/assets/_app/immutable/chunks/D8EpLgQ1.js
Normal file
2
webapp/assets/_app/immutable/chunks/D8EpLgQ1.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/chunks/DDhBTdDt.js
Normal file
1
webapp/assets/_app/immutable/chunks/DDhBTdDt.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as U}from"./B3Pzt0F_.js";import{f as I,j as t,k as p,r as a,t as P,v as b,c as u,z as N,D as A,p as W,u as z,n as H,d as X}from"./D8EpLgQ1.js";import{p as s,i as T}from"./5WA7h8uK.js";import{s as Y,h as Z,B as F,c as $}from"./CiE1LlKV.js";import{b as ee}from"./CoIRRsD9.js";import{D as te,G as ae,a as se}from"./C9DJVOi1.js";import{E as ne}from"./B7ITzBt8.js";import{S as B}from"./BE4wujub.js";var le=I('<div class="flex-shrink-0"><!></div>'),ie=I('<div class="mt-4 sm:mt-0 flex space-x-3"><!> <!></div>'),re=I('<div class="bg-white dark:bg-gray-800 shadow rounded-lg"><div class="px-4 py-5 sm:p-6"><div class="sm:flex sm:items-center sm:justify-between"><div class="flex items-center space-x-3"><!> <div><h1> </h1> <p class="text-sm text-gray-500 dark:text-gray-400"> </p></div></div> <!></div></div></div>');function ye(L,e){let n=s(e,"title",8),S=s(e,"subtitle",8),_=s(e,"forgeIcon",8,""),f=s(e,"onEdit",8,null),h=s(e,"onDelete",8,null),k=s(e,"editLabel",8,"Edit"),j=s(e,"deleteLabel",8,"Delete"),g=s(e,"titleClass",8,"");var c=re(),v=t(c),m=t(v),y=t(m),C=t(y);{var E=i=>{var r=le(),w=t(r);Z(w,_),a(r),u(i,r)};T(C,i=>{_()&&i(E)})}var l=p(C,2),D=t(l),G=t(D,!0);a(D);var M=p(D,2),V=t(M,!0);a(M),a(l),a(y);var R=p(y,2);{var q=i=>{var r=ie(),w=t(r);{var J=o=>{F(o,{variant:"secondary",size:"md",icon:"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z'/>",$$events:{click(...d){f()?.apply(this,d)}},children:(d,Q)=>{N();var x=A();P(()=>b(x,k())),u(d,x)},$$slots:{default:!0}})};T(w,o=>{f()&&o(J)})}var K=p(w,2);{var O=o=>{F(o,{variant:"danger",size:"md",icon:"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16'/>",$$events:{click(...d){h()?.apply(this,d)}},children:(d,Q)=>{N();var x=A();P(()=>b(x,j())),u(d,x)},$$slots:{default:!0}})};T(K,o=>{h()&&o(O)})}a(r),u(i,r)};T(R,i=>{(f()||h())&&i(q)})}a(m),a(v),a(c),P(()=>{Y(D,1,`text-2xl font-bold text-gray-900 dark:text-white ${g()??""}`),b(G,n()),b(V,S())}),u(L,c)}var oe=I('<div class="bg-white dark:bg-gray-800 shadow rounded-lg"><div class="px-4 py-5 sm:p-6"><div class="flex items-center justify-between mb-4"><h2 class="text-lg font-medium text-gray-900 dark:text-white"> </h2> <a class="text-sm text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300">View all instances</a></div> <!></div></div>');function xe(L,e){W(e,!1);let n=s(e,"instances",8),S=s(e,"entityType",8),_=s(e,"onDeleteInstance",8);const f=[{key:"name",title:"Name",cellComponent:ne,cellProps:{entityType:"instance",nameField:"name"}},{key:"status",title:"Status",cellComponent:B,cellProps:{statusType:"instance",statusField:"status"}},{key:"runner_status",title:"Runner Status",cellComponent:B,cellProps:{statusType:"instance",statusField:"runner_status"}},{key:"created",title:"Created",cellComponent:ae,cellProps:{field:"created_at",type:"date"}},{key:"actions",title:"Actions",align:"right",cellComponent:se,cellProps:{actions:[{type:"delete",label:"Delete",title:"Delete instance",ariaLabel:"Delete instance",action:"delete"}]}}],h={entityType:"instance",primaryText:{field:"name",isClickable:!0,href:"/instances/{name}"},secondaryText:{field:"provider_id"},badges:[{type:"status",field:"status"}],actions:[{type:"delete",handler:l=>k(l)}]};function k(l){_()(l)}function j(l){k(l.detail.item)}U();var g=oe(),c=t(g),v=t(c),m=t(v),y=t(m);a(m);var C=p(m,2);a(v);var E=p(v,2);te(E,{get columns(){return f},get data(){return n()},loading:!1,error:"",searchTerm:"",showSearch:!1,showPagination:!1,currentPage:1,get perPage(){return H(n()),z(()=>n().length)},totalPages:1,get totalItems(){return H(n()),z(()=>n().length)},itemName:"instances",emptyTitle:"No instances running",get emptyMessage(){return`No instances running for this ${S()??""}.`},emptyIconType:"cog",get mobileCardConfig(){return h},$$events:{delete:j}}),a(c),a(g),P(()=>{b(y,`Instances (${H(n()),z(()=>n().length)??""})`),$(C,"href",`${ee}/instances`)}),u(L,g),X()}export{ye as D,xe as I};
|
||||||
1
webapp/assets/_app/immutable/chunks/DQP15tlf.js
Normal file
1
webapp/assets/_app/immutable/chunks/DQP15tlf.js
Normal file
File diff suppressed because one or more lines are too long
4
webapp/assets/_app/immutable/chunks/DZblzgqm.js
Normal file
4
webapp/assets/_app/immutable/chunks/DZblzgqm.js
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as g}from"./B3Pzt0F_.js";import{p as k,l as x,s as d,m as w,n as y,a as J,f as m,j as z,w as j,k as L,g as c,r as B,t as C,c as n,d as E}from"./D8EpLgQ1.js";import{p as o,i as M}from"./5WA7h8uK.js";import{c as f,s as N}from"./CiE1LlKV.js";import{b as O}from"./C6k1Q4We.js";var S=m('<div class="absolute top-2 right-2"><svg class="w-4 h-4 text-red-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path></svg></div>'),V=m('<div class="relative"><textarea style="tab-size: 2;" spellcheck="false"></textarea> <!></div>');function I(p,r){k(r,!1);let t=o(r,"value",12,""),u=o(r,"placeholder",8,"{}"),b=o(r,"rows",8,4),i=o(r,"disabled",8,!1),a=w(!0);x(()=>y(t()),()=>{if(t().trim())try{JSON.parse(t()),d(a,!0)}catch{d(a,!1)}else d(a,!0)}),J(),g();var l=V(),e=z(l);j(e);var v=L(e,2);{var h=s=>{var _=S();n(s,_)};M(v,s=>{c(a)||s(h)})}B(l),C(()=>{f(e,"placeholder",u()),f(e,"rows",b()),e.disabled=i(),N(e,1,`w-full px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 font-mono text-sm resize-none
|
||||||
|
${c(a)?"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white":"border-red-300 dark:border-red-600 bg-red-50 dark:bg-red-900/20 text-red-900 dark:text-red-100"}
|
||||||
|
${i()?"opacity-50 cursor-not-allowed":""}
|
||||||
|
`)}),O(e,t),n(p,l),E()}export{I as J};
|
||||||
1
webapp/assets/_app/immutable/chunks/Dbd6PPbz.js
Normal file
1
webapp/assets/_app/immutable/chunks/Dbd6PPbz.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as ae}from"./B3Pzt0F_.js";import{p as se,E as re,l as P,n as ie,s as r,g as t,m as k,a as le,f as p,j as v,k as U,r as f,c as l,d as oe,B as T,b as $,z as V,D as q,t as E,v as N,u as ne}from"./D8EpLgQ1.js";import{p as R,i as m}from"./5WA7h8uK.js";import{g as u,B as G}from"./CiE1LlKV.js";import{t as y}from"./BEkVdVE1.js";var de=p('<div class="flex items-center"><div class="animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600 mr-2"></div> <span class="text-sm text-gray-500 dark:text-gray-400">Checking...</span></div>'),ce=p('<div class="ml-4 text-xs text-gray-500 dark:text-gray-400"> </div>'),ve=p('<div class="flex items-center"><svg class="w-4 h-4 text-green-500 mr-2" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg> <span class="text-sm text-green-700 dark:text-green-300">Webhook installed</span></div> <!>',1),fe=p('<div class="flex items-center"><svg class="w-4 h-4 text-gray-400 mr-2" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm0-2a6 6 0 100-12 6 6 0 000 12zm0-10a1 1 0 011 1v3a1 1 0 01-2 0V7a1 1 0 011-1z" clip-rule="evenodd"></path></svg> <span class="text-sm text-gray-500 dark:text-gray-400">No webhook installed</span></div>'),ue=p('<div class="bg-white dark:bg-gray-800 shadow rounded-lg"><div class="px-4 py-5 sm:p-6"><div class="flex items-center justify-between"><div><h3 class="text-lg font-medium text-gray-900 dark:text-white">Webhook Status</h3> <div class="mt-1 flex items-center"><!></div></div> <div class="flex space-x-2"><!></div></div></div></div>');function ye(H,g){se(g,!1);const x=k();let h=R(g,"entityType",8),s=R(g,"entityId",8),j=R(g,"entityName",8),i=k(null),o=k(!1),b=k(!0);const O=re();async function _(){if(s())try{r(b,!0),h()==="repository"?r(i,await u.getRepositoryWebhookInfo(s())):r(i,await u.getOrganizationWebhookInfo(s()))}catch(e){e&&typeof e=="object"&&"response"in e&&e.response?.status===404?r(i,null):(console.warn("Failed to check webhook status:",e),r(i,null))}finally{r(b,!1)}}async function J(){if(s())try{r(o,!0),h()==="repository"?await u.installRepositoryWebhook(s()):await u.installOrganizationWebhook(s()),y.success("Webhook Installed",`Webhook for ${h()} ${j()} has been installed successfully.`),await _(),O("webhookStatusChanged",{installed:!0})}catch(e){y.error("Webhook Installation Failed",e instanceof Error?e.message:"Failed to install webhook.")}finally{r(o,!1)}}async function K(){if(s())try{r(o,!0),h()==="repository"?await u.uninstallRepositoryWebhook(s()):await u.uninstallOrganizationWebhook(s()),y.success("Webhook Uninstalled",`Webhook for ${h()} ${j()} has been uninstalled successfully.`),await _(),O("webhookStatusChanged",{installed:!1})}catch(e){y.error("Webhook Uninstall Failed",e instanceof Error?e.message:"Failed to uninstall webhook.")}finally{r(o,!1)}}P(()=>ie(s()),()=>{s()&&_()}),P(()=>t(i),()=>{r(x,t(i)&&t(i).active)}),le(),ae();var w=ue(),A=v(w),D=v(A),W=v(D),L=U(v(W),2),Q=v(L);{var X=e=>{var d=de();l(e,d)},Y=e=>{var d=T(),z=$(d);{var I=a=>{var n=ve(),B=U($(n),2);{var c=C=>{var F=ce(),te=v(F);f(F),E(()=>N(te,`URL: ${t(i),ne(()=>t(i).url||"N/A")??""}`)),l(C,F)};m(B,C=>{t(i)&&C(c)})}l(a,n)},S=a=>{var n=fe();l(a,n)};m(z,a=>{t(x)?a(I):a(S,!1)},!0)}l(e,d)};m(Q,e=>{t(b)?e(X):e(Y,!1)})}f(L),f(W);var M=U(W,2),Z=v(M);{var ee=e=>{var d=T(),z=$(d);{var I=a=>{G(a,{variant:"danger",size:"sm",get disabled(){return t(o)},$$events:{click:K},children:(n,B)=>{V();var c=q();E(()=>N(c,t(o)?"Uninstalling...":"Uninstall")),l(n,c)},$$slots:{default:!0}})},S=a=>{G(a,{variant:"primary",size:"sm",get disabled(){return t(o)},$$events:{click:J},children:(n,B)=>{V();var c=q();E(()=>N(c,t(o)?"Installing...":"Install Webhook")),l(n,c)},$$slots:{default:!0}})};m(z,a=>{t(x)?a(I):a(S,!1)})}l(e,d)};m(Z,e=>{t(b)||e(ee)})}f(M),f(D),f(A),f(w),l(H,w),oe()}export{ye as W};
|
||||||
1
webapp/assets/_app/immutable/chunks/DsnmJJEf.js
Normal file
1
webapp/assets/_app/immutable/chunks/DsnmJJEf.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");
|
||||||
1
webapp/assets/_app/immutable/chunks/KQ2xQpA3.js
Normal file
1
webapp/assets/_app/immutable/chunks/KQ2xQpA3.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as q}from"./B3Pzt0F_.js";import{p as A,E as F,f as y,k as l,j as e,r as a,z as $,D as b,c as o,t as p,v as n,d as G}from"./D8EpLgQ1.js";import{p as v,i as H}from"./5WA7h8uK.js";import{M as I}from"./qB7B8uiS.js";import{B as w}from"./CiE1LlKV.js";var J=y('<p class="mt-1 font-medium text-gray-900 dark:text-white"> </p>'),K=y('<div class="max-w-xl w-full p-6"><div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-red-100 dark:bg-red-900 mb-4"><svg class="h-6 w-6 text-red-600 dark:text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path></svg></div> <div class="text-center"><h3 class="text-lg leading-6 font-medium text-gray-900 dark:text-white mb-2"> </h3> <div class="text-sm text-gray-500 dark:text-gray-400"><p> </p> <!></div></div> <div class="mt-6 flex justify-end space-x-3"><!> <!></div></div>');function W(D,s){A(s,!1);let j=v(s,"title",8),M=v(s,"message",8),g=v(s,"itemName",8,""),d=v(s,"loading",8,!1);const c=F();function B(){c("confirm")}q(),I(D,{$$events:{close:()=>c("close")},children:(C,O)=>{var m=K(),f=l(e(m),2),u=e(f),P=e(u,!0);a(u);var h=l(u,2),x=e(h),z=e(x,!0);a(x);var E=l(x,2);{var L=t=>{var i=J(),r=e(i,!0);a(i),p(()=>n(r,g())),o(t,i)};H(E,t=>{g()&&t(L)})}a(h),a(f);var _=l(f,2),k=e(_);w(k,{variant:"secondary",get disabled(){return d()},$$events:{click:()=>c("close")},children:(t,i)=>{$();var r=b("Cancel");o(t,r)},$$slots:{default:!0}});var N=l(k,2);w(N,{variant:"danger",get disabled(){return d()},get loading(){return d()},$$events:{click:B},children:(t,i)=>{$();var r=b();p(()=>n(r,d()?"Deleting...":"Delete")),o(t,r)},$$slots:{default:!0}}),a(_),a(m),p(()=>{n(P,j()),n(z,M())}),o(C,m)},$$slots:{default:!0}}),G()}export{W as D};
|
||||||
1
webapp/assets/_app/immutable/chunks/duD3WMbl.js
Normal file
1
webapp/assets/_app/immutable/chunks/duD3WMbl.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{I as w}from"./D8EpLgQ1.js";import{g as r}from"./CiE1LlKV.js";const m=!0,z=m,I=()=>window.location.port==="5173",b={isAuthenticated:!1,user:null,loading:!0,needsInitialization:!1},n=w(b);function f(t,a,e=7){const i=new Date;i.setTime(i.getTime()+e*24*60*60*1e3),document.cookie=`${t}=${a};expires=${i.toUTCString()};path=/;SameSite=Lax`}function d(t){const a=t+"=",e=document.cookie.split(";");for(let i=0;i<e.length;i++){let o=e[i];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(a)===0)return o.substring(a.length,o.length)}return null}function g(t){document.cookie=`${t}=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/`}const c={async login(t,a){try{n.update(i=>({...i,loading:!0}));const e=await r.login({username:t,password:a});z&&(f("garm_token",e.token),f("garm_user",t)),r.setToken(e.token),n.set({isAuthenticated:!0,user:t,loading:!1,needsInitialization:!1})}catch(e){throw n.update(i=>({...i,loading:!1})),e}},logout(){g("garm_token"),g("garm_user"),n.set({isAuthenticated:!1,user:null,loading:!1,needsInitialization:!1})},async init(){try{n.update(e=>({...e,loading:!0})),await c.checkInitializationStatus();const t=d("garm_token"),a=d("garm_user");if(t&&a&&(r.setToken(t),await c.checkAuth())){n.set({isAuthenticated:!0,user:a,loading:!1,needsInitialization:!1});return}n.update(e=>({...e,loading:!1,needsInitialization:!1}))}catch{n.update(a=>({...a,loading:!1}))}},async checkInitializationStatus(){try{const t={Accept:"application/json"},a=d("garm_token"),e=I();e&&a&&(t.Authorization=`Bearer ${a}`);const i=await fetch("/api/v1/login",{method:"GET",headers:t,credentials:e?"omit":"include"});if(!i.ok){if(i.status===409&&(await i.json()).error==="init_required")throw n.update(s=>({...s,needsInitialization:!0,loading:!1})),new Error("Initialization required");return}return}catch(t){if(t instanceof Error&&t.message==="Initialization required")throw t;return}},async checkAuth(){try{return await c.checkInitializationStatus(),await r.getControllerInfo(),!0}catch(t){return t instanceof Error&&t.message==="Initialization required"?!1:t?.response?.status===409&&t?.response?.data?.error==="init_required"?(n.update(a=>({...a,needsInitialization:!0,loading:!1})),!1):(c.logout(),!1)}},async initialize(t,a,e,i,o){try{n.update(u=>({...u,loading:!0}));const s=await r.firstRun({username:t,email:a,password:e,full_name:i||t});await c.login(t,e);const l=window.location.origin,h=o?.metadataUrl||`${l}/api/v1/metadata`,p=o?.callbackUrl||`${l}/api/v1/callbacks`,k=o?.webhookUrl||`${l}/webhooks`;await r.updateController({metadata_url:h,callback_url:p,webhook_url:k}),n.update(u=>({...u,needsInitialization:!1}))}catch(s){throw n.update(l=>({...l,loading:!1})),s}}};export{n as a,c as b};
|
||||||
1
webapp/assets/_app/immutable/chunks/ow_oMtSd.js
Normal file
1
webapp/assets/_app/immutable/chunks/ow_oMtSd.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
function a(e){return e?e.replace(/_/g," ").toLowerCase().split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" "):""}function g(e){if(!e)return"bg-gray-50 text-gray-700 ring-gray-600/20 dark:bg-gray-500/10 dark:text-gray-400 dark:ring-gray-500/20";switch(e.toLowerCase()){case"running":case"online":return"bg-green-50 text-green-700 ring-green-600/20 dark:bg-green-500/10 dark:text-green-400 dark:ring-green-500/20";case"idle":case"stopped":return"bg-blue-50 text-blue-700 ring-blue-600/20 dark:bg-blue-500/10 dark:text-blue-400 dark:ring-blue-500/20";case"active":return"bg-yellow-50 text-yellow-700 ring-yellow-600/20 dark:bg-yellow-500/10 dark:text-yellow-400 dark:ring-yellow-500/20";case"creating":case"installing":case"pending_create":case"provisioning":return"bg-purple-50 text-purple-700 ring-purple-600/20 dark:bg-purple-500/10 dark:text-purple-400 dark:ring-purple-500/20 animate-pulse";case"deleting":case"terminating":case"pending_delete":case"destroying":return"bg-orange-50 text-orange-700 ring-orange-600/20 dark:bg-orange-500/10 dark:text-orange-400 dark:ring-orange-500/20 animate-pulse";case"failed":case"error":case"terminated":case"offline":return"bg-red-50 text-red-700 ring-red-600/20 dark:bg-red-500/10 dark:text-red-400 dark:ring-red-500/20";case"pending":case"unknown":return"bg-gray-50 text-gray-700 ring-gray-600/20 dark:bg-gray-500/10 dark:text-gray-400 dark:ring-gray-500/20 animate-pulse";default:return"bg-gray-50 text-gray-700 ring-gray-600/20 dark:bg-gray-500/10 dark:text-gray-400 dark:ring-gray-500/20"}}export{a as f,g};
|
||||||
1
webapp/assets/_app/immutable/chunks/qB7B8uiS.js
Normal file
1
webapp/assets/_app/immutable/chunks/qB7B8uiS.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"./DsnmJJEf.js";import{i as u}from"./B3Pzt0F_.js";import{p as v,E as m,f as h,j as r,r as d,e as t,c as k,d as g}from"./D8EpLgQ1.js";import{d as b}from"./CiE1LlKV.js";var w=h('<div class="fixed inset-0 bg-black/30 dark:bg-black/50 overflow-y-auto h-full w-full z-50 flex items-center justify-center p-4" role="dialog" aria-modal="true" tabindex="-1"><div class="relative mx-auto bg-white dark:bg-gray-800 rounded-lg shadow-lg" role="document"><!></div></div>');function j(s,i){v(i,!1);const l=m();function n(){l("close")}function c(o){o.stopPropagation()}function f(o){o.key==="Escape"&&l("close")}u();var a=w(),e=r(a),p=r(e);b(p,i,"default",{}),d(e),d(a),t("click",e,c),t("click",a,n),t("keydown",a,f),k(s,a),g()}export{j as M};
|
||||||
1
webapp/assets/_app/immutable/chunks/u94nIB4-.js
Normal file
1
webapp/assets/_app/immutable/chunks/u94nIB4-.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/chunks/wyaP0EDu.js
Normal file
1
webapp/assets/_app/immutable/chunks/wyaP0EDu.js
Normal file
File diff suppressed because one or more lines are too long
2
webapp/assets/_app/immutable/entry/app.kAVAdeq9.js
Normal file
2
webapp/assets/_app/immutable/entry/app.kAVAdeq9.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/entry/start.CI0Cdear.js
Normal file
1
webapp/assets/_app/immutable/entry/start.CI0Cdear.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{l as o,a as r}from"../chunks/CTf6mQoE.js";export{o as load_css,r as start};
|
||||||
13
webapp/assets/_app/immutable/nodes/0.DINiyk_8.js
Normal file
13
webapp/assets/_app/immutable/nodes/0.DINiyk_8.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/nodes/1.DcR4nNsi.js
Normal file
1
webapp/assets/_app/immutable/nodes/1.DcR4nNsi.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"../chunks/DsnmJJEf.js";import{i as u}from"../chunks/B3Pzt0F_.js";import{p as h,f as g,b as v,t as d,c as l,d as _,j as s,r as a,k as x,v as o}from"../chunks/D8EpLgQ1.js";import{s as k,p}from"../chunks/CTf6mQoE.js";const $={get error(){return p.error},get status(){return p.status}};k.updated.check;const i=$;var b=g("<h1> </h1> <p> </p>",1);function y(m,c){h(c,!1),u();var r=b(),t=v(r),n=s(t,!0);a(t);var e=x(t,2),f=s(e,!0);a(e),d(()=>{o(n,i.status),o(f,i.error?.message)}),l(m,r),_()}export{y as component};
|
||||||
1
webapp/assets/_app/immutable/nodes/10.LnrIJgIa.js
Normal file
1
webapp/assets/_app/immutable/nodes/10.LnrIJgIa.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import"../chunks/DsnmJJEf.js";import{i as X}from"../chunks/B3Pzt0F_.js";import{p as Y,o as Z,l as ee,a as ae,f as H,h as re,t as _,g as a,e as k,c as w,d as te,$ as se,k as d,D as de,m as f,j as r,s as i,r as t,z as B,v as D}from"../chunks/D8EpLgQ1.js";import{i as oe,s as ie,a as le}from"../chunks/5WA7h8uK.js";import{B as ne,r as q,c as T}from"../chunks/CiE1LlKV.js";import{b as U}from"../chunks/C6k1Q4We.js";import{p as ce}from"../chunks/D4Caz1gY.js";import{g as C}from"../chunks/CTf6mQoE.js";import{b as c}from"../chunks/CoIRRsD9.js";import{a as me,b as ue}from"../chunks/duD3WMbl.js";var pe=H('<div class="rounded-md bg-red-50 dark:bg-red-900 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path></svg></div> <div class="ml-3"><p class="text-sm font-medium text-red-800 dark:text-red-200"> </p></div></div></div>'),ve=H('<div class="min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 py-12 px-4 sm:px-6 lg:px-8"><div class="max-w-md w-full space-y-8"><div><div class="mx-auto h-48 w-auto flex justify-center"><img alt="GARM" class="h-48 w-auto dark:hidden"/> <img alt="GARM" class="h-48 w-auto hidden dark:block"/></div> <h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900 dark:text-white">Sign in to GARM</h2> <p class="mt-2 text-center text-sm text-gray-600 dark:text-gray-400">GitHub Actions Runner Manager</p></div> <form class="mt-8 space-y-6"><div class="rounded-md shadow-sm -space-y-px"><div><label for="username" class="sr-only">Username</label> <input id="username" name="username" type="text" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 placeholder-gray-500 dark:placeholder-gray-400 text-gray-900 dark:text-white bg-white dark:bg-gray-700 rounded-t-md focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm" placeholder="Username"/></div> <div><label for="password" class="sr-only">Password</label> <input id="password" name="password" type="password" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 placeholder-gray-500 dark:placeholder-gray-400 text-gray-900 dark:text-white bg-white dark:bg-gray-700 rounded-b-md focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm" placeholder="Password"/></div></div> <!> <div><!></div></form></div></div>');function Le(I,K){Y(K,!1);const[W,F]=ie(),$=()=>le(me,"$authStore",W);let m=f(""),u=f(""),o=f(!1),l=f("");Z(()=>{J()});function J(){const e=localStorage.getItem("theme");let s=!1;e==="dark"?s=!0:e==="light"?s=!1:s=window.matchMedia("(prefers-color-scheme: dark)").matches,s?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}async function L(){if(!a(m)||!a(u)){i(l,"Please enter both username and password");return}i(o,!0),i(l,"");try{await ue.login(a(m),a(u)),C(`${c}/`)}catch(e){i(l,e instanceof Error?e.message:"Login failed")}finally{i(o,!1)}}function M(e){e.key==="Enter"&&L()}ee(()=>($(),c),()=>{$().isAuthenticated&&C(`${c}/`)}),ae(),X();var g=ve();re(e=>{se.title="Login - GARM"});var z=r(g),h=r(z),S=r(h),A=r(S),N=d(A,2);t(S),B(4),t(h);var b=d(h,2),x=r(b),y=r(x),p=d(r(y),2);q(p),t(y);var G=d(y,2),v=d(r(G),2);q(v),t(G),t(x);var P=d(x,2);{var O=e=>{var s=pe(),n=r(s),E=d(r(n),2),j=r(E),V=r(j,!0);t(j),t(E),t(n),t(s),_(()=>D(V,a(l))),w(e,s)};oe(P,e=>{a(l)&&e(O)})}var R=d(P,2),Q=r(R);ne(Q,{type:"submit",variant:"primary",size:"md",fullWidth:!0,get disabled(){return a(o)},get loading(){return a(o)},children:(e,s)=>{B();var n=de();_(()=>D(n,a(o)?"Signing in...":"Sign in")),w(e,n)},$$slots:{default:!0}}),t(R),t(b),t(z),t(g),_(()=>{T(A,"src",`${c??""}/assets/garm-light.svg`),T(N,"src",`${c??""}/assets/garm-dark.svg`),p.disabled=a(o),v.disabled=a(o)}),U(p,()=>a(m),e=>i(m,e)),k("keypress",p,M),U(v,()=>a(u),e=>i(u,e)),k("keypress",v,M),k("submit",b,ce(L)),w(I,g),te(),F()}export{Le as component};
|
||||||
1
webapp/assets/_app/immutable/nodes/11.Bsn67lBa.js
Normal file
1
webapp/assets/_app/immutable/nodes/11.Bsn67lBa.js
Normal file
File diff suppressed because one or more lines are too long
1
webapp/assets/_app/immutable/nodes/12.B-vC_cmu.js
Normal file
1
webapp/assets/_app/immutable/nodes/12.B-vC_cmu.js
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue