Merge branch 'up-main' into release/v0.1
This commit is contained in:
commit
c31ae7868c
1088 changed files with 120987 additions and 42536 deletions
3
.github/workflows/build-and-push.yml
vendored
3
.github/workflows/build-and-push.yml
vendored
|
|
@ -44,6 +44,9 @@ jobs:
|
|||
docker buildx build \
|
||||
--provenance=false \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--label "org.opencontainers.image.source=https://github.com/cloudbase/garm/tree/${{ github.event.inputs.ref }}" \
|
||||
--label "org.opencontainers.image.description=GARM ${{ github.event.inputs.ref }}" \
|
||||
--label "org.opencontainers.image.licenses=Apache 2.0" \
|
||||
--build-arg="GARM_REF=${{ github.event.inputs.ref }}" \
|
||||
-t ${{ github.event.inputs.push_to_project }}/garm:"${VERSION}" \
|
||||
--push .
|
||||
8
.github/workflows/go-tests.yml
vendored
8
.github/workflows/go-tests.yml
vendored
|
|
@ -24,16 +24,14 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libbtrfs-dev build-essential
|
||||
sudo apt-get install -y libbtrfs-dev build-essential apg jq
|
||||
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 'stable'
|
||||
- uses: actions/checkout@v3
|
||||
- uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
skip-cache: true
|
||||
args: --timeout=8m --build-tags testing
|
||||
- name: make lint
|
||||
run: make golangci-lint && GOLANGCI_LINT_EXTRA_ARGS="--timeout=8m --build-tags=testing,integration" make lint
|
||||
- name: Verify go vendor, go modules and gofmt
|
||||
run: |
|
||||
sudo apt-get install -y jq
|
||||
|
|
|
|||
30
.github/workflows/integration-tests.yml
vendored
30
.github/workflows/integration-tests.yml
vendored
|
|
@ -9,7 +9,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Golang
|
||||
uses: actions/setup-go@v3
|
||||
|
|
@ -19,8 +19,10 @@ jobs:
|
|||
- name: Setup LXD
|
||||
uses: canonical/setup-lxd@v0.1.1
|
||||
|
||||
- name: Build GARM
|
||||
run: make build
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
|
||||
sudo apt-get -qq update && sudo apt-get -qq install -y apg coreutils make
|
||||
|
||||
- name: Set up ngrok
|
||||
id: ngrok
|
||||
|
|
@ -30,17 +32,8 @@ jobs:
|
|||
port: 9997
|
||||
tunnel_type: http
|
||||
|
||||
- name: Setup GARM
|
||||
run: ./test/integration/scripts/setup-garm.sh
|
||||
env:
|
||||
GH_OAUTH_TOKEN: ${{ secrets.GH_OAUTH_TOKEN }}
|
||||
CREDENTIALS_NAME: test-garm-creds
|
||||
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
|
||||
|
||||
- name: Generate secrets
|
||||
run: |
|
||||
sudo apt-get -qq update && sudo apt-get -qq install -y apg
|
||||
|
||||
GARM_PASSWORD=$(apg -n1 -m32)
|
||||
REPO_WEBHOOK_SECRET=$(apg -n1 -m32)
|
||||
ORG_WEBHOOK_SECRET=$(apg -n1 -m32)
|
||||
|
|
@ -52,6 +45,7 @@ jobs:
|
|||
echo "GARM_PASSWORD=$GARM_PASSWORD" >> $GITHUB_ENV
|
||||
echo "REPO_WEBHOOK_SECRET=$REPO_WEBHOOK_SECRET" >> $GITHUB_ENV
|
||||
echo "ORG_WEBHOOK_SECRET=$ORG_WEBHOOK_SECRET" >> $GITHUB_ENV
|
||||
echo "GARM_CHECKOUT_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
|
||||
|
||||
- name: Create logs directory
|
||||
if: always()
|
||||
|
|
@ -61,7 +55,7 @@ jobs:
|
|||
run: |
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
go run ./test/integration/main.go 2>&1 | tee /artifacts-logs/e2e.log
|
||||
make integration 2>&1
|
||||
env:
|
||||
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
|
||||
ORG_NAME: gsamfira
|
||||
|
|
@ -73,8 +67,9 @@ jobs:
|
|||
- name: Show GARM logs
|
||||
if: always()
|
||||
run: |
|
||||
sudo systemctl status garm
|
||||
sudo journalctl -u garm --no-pager 2>&1 | tee /artifacts-logs/garm.log
|
||||
sudo systemctl status garm@runner || true
|
||||
sudo journalctl --no-pager 2>&1 > /artifacts-logs/system.log
|
||||
sudo journalctl -u garm@runner --no-pager 2>&1 > /artifacts-logs/garm.log
|
||||
|
||||
- name: Upload GARM and e2e logs
|
||||
if: always()
|
||||
|
|
@ -89,9 +84,8 @@ jobs:
|
|||
set -o pipefail
|
||||
set -o errexit
|
||||
|
||||
sudo systemctl stop garm
|
||||
|
||||
go run ./test/integration/gh_cleanup/main.go
|
||||
sudo systemctl stop garm@runner || true
|
||||
go run ./test/integration/gh_cleanup/main.go || true
|
||||
env:
|
||||
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
|
||||
ORG_NAME: gsamfira
|
||||
|
|
|
|||
40
.golangci.yml
Normal file
40
.golangci.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
linters:
|
||||
disable-all: true
|
||||
fast: false
|
||||
enable:
|
||||
- gci
|
||||
- goconst
|
||||
- gocritic
|
||||
- gocyclo
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goimports
|
||||
- godox
|
||||
- govet
|
||||
- gosec
|
||||
- gosimple
|
||||
- importas
|
||||
- ineffassign
|
||||
- loggercheck
|
||||
- misspell
|
||||
- nakedret
|
||||
- nilerr
|
||||
- predeclared
|
||||
- promlinter
|
||||
- revive
|
||||
- staticcheck
|
||||
- unconvert
|
||||
- unused
|
||||
- wastedassign
|
||||
- whitespace
|
||||
|
||||
linters-settings:
|
||||
gci:
|
||||
sections:
|
||||
- standard
|
||||
- default
|
||||
- prefix(github.com/cloudbase/garm)
|
||||
|
||||
goimports:
|
||||
local-prefixes: github.com/cloudbase/garm
|
||||
42
Dockerfile
42
Dockerfile
|
|
@ -8,40 +8,42 @@ RUN git config --global --add safe.directory /build
|
|||
|
||||
ADD . /build/garm
|
||||
RUN cd /build/garm && git checkout ${GARM_REF}
|
||||
RUN git clone https://github.com/cloudbase/garm-provider-azure /build/garm-provider-azure
|
||||
RUN git clone https://github.com/cloudbase/garm-provider-openstack /build/garm-provider-openstack
|
||||
RUN git clone https://github.com/cloudbase/garm-provider-lxd /build/garm-provider-lxd
|
||||
RUN git clone https://github.com/cloudbase/garm-provider-incus /build/garm-provider-incus
|
||||
RUN git clone https://github.com/mercedes-benz/garm-provider-k8s /build/garm-provider-k8s
|
||||
RUN git clone https://github.com/cloudbase/garm-provider-aws /build/garm-provider-aws
|
||||
RUN git clone https://github.com/cloudbase/garm-provider-gcp /build/garm-provider-gcp
|
||||
RUN git clone https://github.com/cloudbase/garm-provider-equinix /build/garm-provider-equinix
|
||||
RUN git clone --depth 1 --branch v0.1.0 https://github.com/cloudbase/garm-provider-azure /build/garm-provider-azure
|
||||
RUN git clone --depth 1 --branch v0.1.0 https://github.com/cloudbase/garm-provider-openstack /build/garm-provider-openstack
|
||||
RUN git clone --depth 1 --branch v0.1.0 https://github.com/cloudbase/garm-provider-lxd /build/garm-provider-lxd
|
||||
RUN git clone --depth 1 --branch v0.1.0 https://github.com/cloudbase/garm-provider-incus /build/garm-provider-incus
|
||||
RUN git clone --depth 1 --branch v0.1.0 https://github.com/cloudbase/garm-provider-aws /build/garm-provider-aws
|
||||
RUN git clone --depth 1 --branch v0.1.0 https://github.com/cloudbase/garm-provider-gcp /build/garm-provider-gcp
|
||||
RUN git clone --depth 1 --branch v0.1.0 https://github.com/cloudbase/garm-provider-equinix /build/garm-provider-equinix
|
||||
|
||||
RUN git clone --depth 1 --branch v0.3.1 https://github.com/mercedes-benz/garm-provider-k8s /build/garm-provider-k8s
|
||||
|
||||
RUN cd /build/garm && go build -o /bin/garm \
|
||||
-tags osusergo,netgo,sqlite_omit_load_extension \
|
||||
-ldflags "-extldflags '-static' -s -w -X main.Version=$(git describe --tags --match='v[0-9]*' --dirty --always)" \
|
||||
-ldflags "-linkmode external -extldflags '-static' -s -w -X github.com/cloudbase/garm/util/appdefaults.Version=$(git describe --tags --match='v[0-9]*' --dirty --always)" \
|
||||
/build/garm/cmd/garm && upx /bin/garm
|
||||
RUN mkdir -p /opt/garm/providers.d
|
||||
RUN cd /build/garm-provider-azure && go build -ldflags="-extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-azure . && upx /opt/garm/providers.d/garm-provider-azure
|
||||
RUN cd /build/garm-provider-openstack && go build -ldflags="-extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-openstack . && upx /opt/garm/providers.d/garm-provider-openstack
|
||||
RUN cd /build/garm-provider-lxd && go build -ldflags="-extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-lxd . && upx /opt/garm/providers.d/garm-provider-lxd
|
||||
RUN cd /build/garm-provider-incus && go build -ldflags="-extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-incus . && upx /opt/garm/providers.d/garm-provider-incus
|
||||
RUN cd /build/garm-provider-k8s/cmd/garm-provider-k8s && go build -ldflags="-extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-k8s . && upx /opt/garm/providers.d/garm-provider-k8s
|
||||
RUN cd /build/garm-provider-aws && go build -ldflags="-extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-aws . && upx /opt/garm/providers.d/garm-provider-aws
|
||||
RUN cd /build/garm-provider-gcp && go build -ldflags="-extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-gcp . && upx /opt/garm/providers.d/garm-provider-gcp
|
||||
RUN cd /build/garm-provider-equinix && go build -ldflags="-extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-equinix . && upx /opt/garm/providers.d/garm-provider-equinix
|
||||
RUN cd /build/garm-provider-azure && go build -ldflags="-linkmode external -extldflags '-static' -s -w -X main.Version=v0.1.0" -o /opt/garm/providers.d/garm-provider-azure . && upx /opt/garm/providers.d/garm-provider-azure
|
||||
RUN cd /build/garm-provider-openstack && go build -ldflags="-linkmode external -extldflags '-static' -s -w -X main.Version=v0.1.0" -o /opt/garm/providers.d/garm-provider-openstack . && upx /opt/garm/providers.d/garm-provider-openstack
|
||||
RUN cd /build/garm-provider-lxd && go build -ldflags="-linkmode external -extldflags '-static' -s -w -X main.Version=v0.1.0" -o /opt/garm/providers.d/garm-provider-lxd . && upx /opt/garm/providers.d/garm-provider-lxd
|
||||
RUN cd /build/garm-provider-incus && go build -ldflags="-linkmode external -extldflags '-static' -s -w -X main.Version=v0.1.0" -o /opt/garm/providers.d/garm-provider-incus . && upx /opt/garm/providers.d/garm-provider-incus
|
||||
RUN cd /build/garm-provider-aws && go build -ldflags="-linkmode external -extldflags '-static' -s -w -X main.Version=v0.1.0" -o /opt/garm/providers.d/garm-provider-aws . && upx /opt/garm/providers.d/garm-provider-aws
|
||||
RUN cd /build/garm-provider-gcp && go build -ldflags="-linkmode external -extldflags '-static' -s -w -X main.Version=v0.1.0" -o /opt/garm/providers.d/garm-provider-gcp . && upx /opt/garm/providers.d/garm-provider-gcp
|
||||
RUN cd /build/garm-provider-equinix && go build -ldflags="-linkmode external -extldflags '-static' -s -w -X main.Version=v0.1.0" -o /opt/garm/providers.d/garm-provider-equinix . && upx /opt/garm/providers.d/garm-provider-equinix
|
||||
|
||||
FROM scratch
|
||||
RUN cd /build/garm-provider-k8s/cmd/garm-provider-k8s && go build -ldflags="-linkmode external -extldflags '-static' -s -w" -o /opt/garm/providers.d/garm-provider-k8s . && upx /opt/garm/providers.d/garm-provider-k8s
|
||||
|
||||
FROM busybox
|
||||
|
||||
COPY --from=builder /bin/garm /bin/garm
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-openstack /opt/garm/providers.d/garm-provider-openstack
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-lxd /opt/garm/providers.d/garm-provider-lxd
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-incus /opt/garm/providers.d/garm-provider-incus
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-k8s /opt/garm/providers.d/garm-provider-k8s
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-azure /opt/garm/providers.d/garm-provider-azure
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-aws /opt/garm/providers.d/garm-provider-aws
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-gcp /opt/garm/providers.d/garm-provider-gcp
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-equinix /opt/garm/providers.d/garm-provider-equinix
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
|
||||
COPY --from=builder /opt/garm/providers.d/garm-provider-k8s /opt/garm/providers.d/garm-provider-k8s
|
||||
|
||||
ENTRYPOINT ["/bin/garm", "-config", "/etc/garm/config.toml"]
|
||||
|
|
|
|||
111
Makefile
111
Makefile
|
|
@ -1,5 +1,9 @@
|
|||
SHELL := bash
|
||||
SHELL := /bin/bash
|
||||
export SHELLOPTS:=$(if $(SHELLOPTS),$(SHELLOPTS):)pipefail:errexit
|
||||
|
||||
.ONESHELL:
|
||||
|
||||
GEN_PASSWORD=$(shell (/usr/bin/apg -n1 -m32))
|
||||
IMAGE_TAG = garm-build
|
||||
|
||||
USER_ID=$(shell ((docker --version | grep -q podman) && echo "0" || id -u))
|
||||
|
|
@ -9,48 +13,57 @@ GOPATH ?= $(shell go env GOPATH)
|
|||
VERSION ?= $(shell git describe --tags --match='v[0-9]*' --dirty --always)
|
||||
GARM_REF ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||
GO ?= go
|
||||
export GARM_PASSWORD ?= ${GEN_PASSWORD}
|
||||
export REPO_WEBHOOK_SECRET = ${GEN_PASSWORD}
|
||||
export ORG_WEBHOOK_SECRET = ${GEN_PASSWORD}
|
||||
export CREDENTIALS_NAME ?= test-garm-creds
|
||||
export WORKFLOW_FILE_NAME ?= test.yml
|
||||
export GARM_ADMIN_USERNAME ?= admin
|
||||
|
||||
.PHONY: help
|
||||
help: ## Display this help.
|
||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||
|
||||
|
||||
default: build
|
||||
|
||||
##@ Build
|
||||
|
||||
.PHONY : build-static test install-lint-deps lint go-test fmt fmtcheck verify-vendor verify create-release-files release
|
||||
build-static:
|
||||
build-static: ## Build garm statically
|
||||
@echo Building garm
|
||||
docker build --tag $(IMAGE_TAG) -f Dockerfile.build-static .
|
||||
mkdir -p build
|
||||
docker run --rm -e USER_ID=$(USER_ID) -e GARM_REF=$(GARM_REF) -e USER_GROUP=$(USER_GROUP) -v $(PWD)/build:/build/output:z $(IMAGE_TAG) /build-static.sh
|
||||
@echo Binaries are available in $(PWD)/build
|
||||
|
||||
clean: ## Clean up build artifacts
|
||||
@rm -rf ./bin ./build ./release
|
||||
|
||||
.PHONY: build
|
||||
build: ## Build garm
|
||||
@echo Building garm ${VERSION}
|
||||
$(shell mkdir -p ./bin)
|
||||
@$(GO) build -ldflags "-s -w -X github.com/cloudbase/garm/util/appdefaults.Version=${VERSION}" -tags osusergo,netgo,sqlite_omit_load_extension -o bin/garm ./cmd/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
|
||||
@echo Binaries are available in $(PWD)/bin
|
||||
|
||||
test: verify go-test ## Run tests
|
||||
|
||||
##@ Release
|
||||
create-release-files:
|
||||
./scripts/make-release.sh
|
||||
|
||||
release: build-static create-release-files
|
||||
release: build-static create-release-files ## Create a release
|
||||
|
||||
clean:
|
||||
@rm -rf ./bin ./build ./release
|
||||
##@ Lint / Verify
|
||||
.PHONY: lint
|
||||
lint: golangci-lint $(GOLANGCI_LINT) ## Run linting.
|
||||
$(GOLANGCI_LINT) run -v --build-tags=testing,integration $(GOLANGCI_LINT_EXTRA_ARGS)
|
||||
|
||||
build:
|
||||
@echo Building garm ${VERSION}
|
||||
$(shell mkdir -p ./bin)
|
||||
@$(GO) build -ldflags "-s -w -X main.Version=${VERSION}" -tags osusergo,netgo,sqlite_omit_load_extension -o bin/garm ./cmd/garm
|
||||
@$(GO) build -ldflags "-s -w -X github.com/cloudbase/garm/cmd/garm-cli/cmd.Version=${VERSION}" -tags osusergo,netgo,sqlite_omit_load_extension -o bin/garm-cli ./cmd/garm-cli
|
||||
@echo Binaries are available in $(PWD)/bin
|
||||
|
||||
test: verify go-test
|
||||
|
||||
install-lint-deps:
|
||||
@$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
|
||||
lint:
|
||||
@golangci-lint run --timeout=8m --build-tags testing
|
||||
|
||||
go-test:
|
||||
@$(GO) test -race -mod=vendor -tags testing -v $(TEST_ARGS) -timeout=15m -parallel=4 -count=1 ./...
|
||||
|
||||
fmt:
|
||||
@$(GO) fmt $$(go list ./...)
|
||||
|
||||
fmtcheck:
|
||||
@gofmt -l -s $$(go list ./... | sed 's|github.com/cloudbase/garm/||g') | grep ".*\.go"; if [ "$$?" -eq 0 ]; then echo "gofmt check failed; please run gofmt -w -s"; exit 1;fi
|
||||
.PHONY: lint-fix
|
||||
lint-fix: golangci-lint $(GOLANGCI_LINT) ## Lint the codebase and run auto-fixers if supported by the linte
|
||||
GOLANGCI_LINT_EXTRA_ARGS=--fix $(MAKE) lint
|
||||
|
||||
verify-vendor: ## verify if all the go.mod/go.sum files are up-to-date
|
||||
$(eval TMPDIR := $(shell mktemp -d))
|
||||
|
|
@ -59,4 +72,44 @@ verify-vendor: ## verify if all the go.mod/go.sum files are up-to-date
|
|||
@diff -r -u -q ${ROOTDIR} ${TMPDIR}/garm >/dev/null 2>&1; if [ "$$?" -ne 0 ];then echo "please run: go mod tidy && go mod vendor"; exit 1; fi
|
||||
@rm -rf ${TMPDIR}
|
||||
|
||||
verify: verify-vendor lint fmtcheck
|
||||
verify: verify-vendor lint fmtcheck ## Run all verify-* targets
|
||||
|
||||
integration: build ## Run integration tests
|
||||
function cleanup {
|
||||
if [ -e "$$GITHUB_ENV" ];then
|
||||
source $$GITHUB_ENV
|
||||
fi
|
||||
./test/integration/scripts/taredown_garm.sh
|
||||
$(GO) run ./test/integration/gh_cleanup/main.go
|
||||
}
|
||||
trap cleanup EXIT
|
||||
@./test/integration/scripts/setup-garm.sh
|
||||
@$(GO) test -v ./test/integration/. -timeout=30m -tags=integration
|
||||
|
||||
##@ Development
|
||||
|
||||
go-test: ## Run tests
|
||||
@$(GO) test -race -mod=vendor -tags testing -v $(TEST_ARGS) -timeout=15m -parallel=4 -count=1 ./...
|
||||
|
||||
fmt: ## Run go fmt against code.
|
||||
@$(GO) fmt $$(go list ./...)
|
||||
|
||||
|
||||
##@ Build Dependencies
|
||||
|
||||
## Location to install dependencies to
|
||||
LOCALBIN ?= $(shell pwd)/bin
|
||||
$(LOCALBIN):
|
||||
mkdir -p $(LOCALBIN)
|
||||
|
||||
## Tool Binaries
|
||||
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
|
||||
|
||||
## Tool Versions
|
||||
GOLANGCI_LINT_VERSION ?= v1.56.2
|
||||
|
||||
.PHONY: golangci-lint
|
||||
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. If wrong version is installed, it will be overwritten.
|
||||
$(GOLANGCI_LINT): $(LOCALBIN)
|
||||
test -s $(LOCALBIN)/golangci-lint && $(LOCALBIN)/golangci-lint --version | grep -q $(GOLANGCI_LINT_VERSION) || \
|
||||
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
|
||||
|
|
|
|||
54
README.md
54
README.md
|
|
@ -2,15 +2,39 @@
|
|||
|
||||
[](https://github.com/cloudbase/garm/actions/workflows/go-tests.yml)
|
||||
|
||||
<!-- TOC -->
|
||||
|
||||
- [About GARM](#about-garm)
|
||||
- [Join us on slack](#join-us-on-slack)
|
||||
- [Installing](#installing)
|
||||
- [Quickstart](#quickstart)
|
||||
- [Installing on Kubernetes](#installing-on-kubernetes)
|
||||
- [Using GARM](#using-garm)
|
||||
- [Supported providers](#supported-providers)
|
||||
- [Installing external providers](#installing-external-providers)
|
||||
- [Optimizing your runners](#optimizing-your-runners)
|
||||
- [Write your own provider](#write-your-own-provider)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
## About GARM
|
||||
|
||||
Welcome to GARM!
|
||||
|
||||
GARM enables you to create and automatically maintain pools of [self-hosted GitHub runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners), with auto-scaling that can be used inside your github workflow runs.
|
||||
|
||||
The goal of ```GARM``` is to be simple to set up, simple to configure and simple to use. It is a single binary that can run on any GNU/Linux machine without any other requirements other than the providers it creates the runners in. It is intended to be easy to deploy in any environment and can create runners in any system you can write a provider for. There is no complicated setup process and no extremely complex concepts to understand. Once set up, it's meant to stay out of your way.
|
||||
The goal of ```GARM``` is to be simple to set up, simple to configure and simple to use. The server itself is a single binary that can run on any GNU/Linux machine without any other requirements other than the providers you want to enable in your setup. It is intended to be easy to deploy in any environment and can create runners in virtually any system you can write a provider for. There is no complicated setup process and no extremely complex concepts to understand. Once set up, it's meant to stay out of your way.
|
||||
|
||||
GARM supports creating pools on either GitHub itself or on your own deployment of [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@3.5/admin/overview/about-github-enterprise-server). For instructions on how to use ```GARM``` with GHE, see the [credentials](/doc/github_credentials.md) section of the documentation.
|
||||
GARM supports creating pools in either GitHub itself or in your own deployment of [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@3.10/admin/overview/about-github-enterprise-server). For instructions on how to use ```GARM``` with GHE, see the [credentials](/doc/github_credentials.md) section of the documentation.
|
||||
|
||||
Through the use of providers, `GARM` can create runners in a variety of environments using the same `GARM` instance. Want to create pools of runners in your OpenStack cloud, your Azure cloud and your Kubernetes cluster? No problem! Just install the appropriate providers, configure them in `GARM` and you're good to go. Create zero-runner pools for instances with high costs (large VMs, GPU enabled instances, etc) and have them spin up on demand, or create large pools of k8s backed runners that can be used for your CI/CD pipelines at a moment's notice. You can mix them up and create pools in any combination of providers or resource allocations you want.
|
||||
Through the use of providers, `GARM` can create runners in a variety of environments using the same `GARM` instance. Whether you want to create pools of runners in your OpenStack cloud, your Azure cloud or your Kubernetes cluster, that is easily achieved by just installing the appropriate providers, configuring them in `GARM` and creating pools that use them. You can create zero-runner pools for instances with high costs (large VMs, GPU enabled instances, etc) and have them spin up on demand, or you can create large pools of eagerly created k8s backed runners that can be used for your CI/CD pipelines at a moment's notice. You can mix them up and create pools in any combination of providers or resource allocations you want.
|
||||
|
||||
Here is a brief architectural diagram of how GARM reacts to workflows triggered in GitHub (click the image to see a larger version):
|
||||
|
||||

|
||||

|
||||
|
||||
:warning: **Important note**: The README and documentation in the `main` branch are relevant to the not yet released code that is present in `main`. Following the documentation from the `main` branch for a stable release of GARM, may lead to errors. To view the documentation for the latest stable release, please switch to the appropriate tag. For information about setting up `v0.1.5`, please refer to the [v0.1.5 tag](https://github.com/cloudbase/garm/tree/v0.1.5).
|
||||
|
||||
## Join us on slack
|
||||
|
||||
|
|
@ -20,36 +44,23 @@ Whether you're running into issues or just want to drop by and say "hi", feel fr
|
|||
|
||||
## Installing
|
||||
|
||||
### On virtual or physical machines
|
||||
### Quickstart
|
||||
|
||||
Check out the [quickstart](/doc/quickstart.md) document for instructions on how to install ```GARM```. If you'd like to build from source, check out the [building from source](/doc/building_from_source.md) document.
|
||||
|
||||
### On Kubernetes
|
||||
### Installing on Kubernetes
|
||||
|
||||
Thanks to the efforts of the amazing folks at @mercedes-benz, GARM can now be integrated into k8s via their operator. Check out the [GARM operator](https://github.com/mercedes-benz/garm-operator/) for more details.
|
||||
|
||||
## Configuration
|
||||
|
||||
The ```GARM``` configuration is a simple ```toml```. The sample config file in [the testdata folder](/testdata/config.toml) is fairly well commented and should be enough to get you started. The configuration file is split into several sections, each of which is documented in its own page. The sections are:
|
||||
|
||||
* [The default section](/doc/config_default.md)
|
||||
* [Logging](/doc/config_logging.md)
|
||||
* [Database](/doc/database.md)
|
||||
* [Github credentials](/doc/github_credentials.md)
|
||||
* [Providers](/doc/providers.md)
|
||||
* [Metrics](/doc/config_metrics.md)
|
||||
* [JWT authentication](/doc/config_jwt_auth.md)
|
||||
* [API server](/doc/config_api_server.md)
|
||||
Thanks to the efforts of the amazing folks at [@mercedes-benz](https://github.com/mercedes-benz/), GARM can now be integrated into k8s via their operator. Check out the [GARM operator](https://github.com/mercedes-benz/garm-operator/) for more details.
|
||||
|
||||
## 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.
|
||||
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.
|
||||
|
||||
We've written a short introduction into some of the commands that GARM has and some of the concepts involved in setting up GARM, managing runners and how GitHub does some of the things it does.
|
||||
|
||||
[You can find it here](/doc/using_garm.md).
|
||||
|
||||
Please, feel free to [open an issue](https://github.com/cloudbase/garm/issues/new) if you find the documentation lacking and would like more info. Sometimes we forget the challanges that new users face as we're so close to the code and how it works. Any feedback is welcome and we're always looking to improve the documentation.
|
||||
Please, feel free to [open an issue](https://github.com/cloudbase/garm/issues/new) if you find the documentation lacking and would like more info. Sometimes we forget the challenges that new users face as we're so close to the code and how it works. Any feedback is welcome and we're always looking to improve the documentation.
|
||||
|
||||
## Supported providers
|
||||
|
||||
|
|
@ -67,6 +78,7 @@ External providers are binaries that GARM calls into to create runners in a part
|
|||
* [Equinix Metal](https://github.com/cloudbase/garm-provider-equinix)
|
||||
* [Amazon EC2](https://github.com/cloudbase/garm-provider-aws)
|
||||
* [Google Cloud Platform (GCP)](https://github.com/cloudbase/garm-provider-gcp)
|
||||
* [Oracle Cloud Infrastructure (OCI)](https://github.com/cloudbase/garm-provider-oci)
|
||||
|
||||
Follow the instructions in the README of each provider to install them.
|
||||
|
||||
|
|
|
|||
|
|
@ -22,22 +22,23 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/apiserver/events"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/metrics"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/runner"
|
||||
"github.com/cloudbase/garm/runner" //nolint:typecheck
|
||||
wsWriter "github.com/cloudbase/garm/websocket"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func NewAPIController(r *runner.Runner, authenticator *auth.Authenticator, hub *wsWriter.Hub) (*APIController, error) {
|
||||
controllerInfo, err := r.GetControllerInfo(auth.GetAdminContext())
|
||||
controllerInfo, err := r.GetControllerInfo(auth.GetAdminContext(context.Background()))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get controller info")
|
||||
}
|
||||
|
|
@ -95,19 +96,6 @@ func handleError(ctx context.Context, w http.ResponseWriter, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
func (a *APIController) webhookMetricLabelValues(ctx context.Context, valid, reason string) []string {
|
||||
controllerInfo, err := a.r.GetControllerInfo(auth.GetAdminContext())
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to get controller info")
|
||||
// If labels are empty, not attempt will be made to record webhook.
|
||||
return []string{}
|
||||
}
|
||||
return []string{
|
||||
valid, reason,
|
||||
controllerInfo.Hostname, controllerInfo.ControllerID.String(),
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIController) handleWorkflowJobEvent(ctx context.Context, w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
body, err := io.ReadAll(r.Body)
|
||||
|
|
@ -119,31 +107,35 @@ func (a *APIController) handleWorkflowJobEvent(ctx context.Context, w http.Respo
|
|||
signature := r.Header.Get("X-Hub-Signature-256")
|
||||
hookType := r.Header.Get("X-Github-Hook-Installation-Target-Type")
|
||||
|
||||
var labelValues []string
|
||||
defer func() {
|
||||
if len(labelValues) == 0 {
|
||||
return
|
||||
}
|
||||
if err := metrics.RecordWebhookWithLabels(labelValues...); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to record metric")
|
||||
}
|
||||
}()
|
||||
|
||||
if err := a.r.DispatchWorkflowJob(hookType, signature, body); err != nil {
|
||||
if errors.Is(err, gErrors.ErrNotFound) {
|
||||
labelValues = a.webhookMetricLabelValues(ctx, "false", "owner_unknown")
|
||||
switch {
|
||||
case errors.Is(err, gErrors.ErrNotFound):
|
||||
metrics.WebhooksReceived.WithLabelValues(
|
||||
"false", // label: valid
|
||||
"owner_unknown", // label: reason
|
||||
).Inc()
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "got not found error from DispatchWorkflowJob. webhook not meant for us?")
|
||||
return
|
||||
} else if strings.Contains(err.Error(), "signature") { // TODO: check error type
|
||||
labelValues = a.webhookMetricLabelValues(ctx, "false", "signature_invalid")
|
||||
} else {
|
||||
labelValues = a.webhookMetricLabelValues(ctx, "false", "unknown")
|
||||
case strings.Contains(err.Error(), "signature"):
|
||||
// nolint:golangci-lint,godox TODO: check error type
|
||||
metrics.WebhooksReceived.WithLabelValues(
|
||||
"false", // label: valid
|
||||
"signature_invalid", // label: reason
|
||||
).Inc()
|
||||
default:
|
||||
metrics.WebhooksReceived.WithLabelValues(
|
||||
"false", // label: valid
|
||||
"unknown", // label: reason
|
||||
).Inc()
|
||||
}
|
||||
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
labelValues = a.webhookMetricLabelValues(ctx, "true", "")
|
||||
metrics.WebhooksReceived.WithLabelValues(
|
||||
"true", // label: valid
|
||||
"", // label: reason
|
||||
).Inc()
|
||||
}
|
||||
|
||||
func (a *APIController) WebhookHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -172,6 +164,43 @@ func (a *APIController) WebhookHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
func (a *APIController) EventsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
if !auth.IsAdmin(ctx) {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
if _, err := w.Write([]byte("events are available to admin users")); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
conn, err := a.upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "error upgrading to websockets")
|
||||
return
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
wsClient, err := wsWriter.NewClient(ctx, conn)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to create new client")
|
||||
return
|
||||
}
|
||||
defer wsClient.Stop()
|
||||
|
||||
eventHandler, err := events.NewHandler(ctx, wsClient)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to create new event handler")
|
||||
return
|
||||
}
|
||||
|
||||
if err := eventHandler.Start(); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to start event handler")
|
||||
return
|
||||
}
|
||||
<-eventHandler.Done()
|
||||
}
|
||||
|
||||
func (a *APIController) WSHandler(writer http.ResponseWriter, req *http.Request) {
|
||||
ctx := req.Context()
|
||||
if !auth.IsAdmin(ctx) {
|
||||
|
|
@ -192,13 +221,9 @@ func (a *APIController) WSHandler(writer http.ResponseWriter, req *http.Request)
|
|||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "error upgrading to websockets")
|
||||
return
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
// TODO (gsamfira): Handle ExpiresAt. Right now, if a client uses
|
||||
// a valid token to authenticate, and keeps the websocket connection
|
||||
// open, it will allow that client to stream logs via websockets
|
||||
// until the connection is broken. We need to forcefully disconnect
|
||||
// the client once the token expires.
|
||||
client, err := wsWriter.NewClient(conn, a.hub)
|
||||
client, err := wsWriter.NewClient(ctx, conn)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to create new client")
|
||||
return
|
||||
|
|
@ -207,7 +232,14 @@ func (a *APIController) WSHandler(writer http.ResponseWriter, req *http.Request)
|
|||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to register new client")
|
||||
return
|
||||
}
|
||||
client.Go()
|
||||
defer a.hub.Unregister(client)
|
||||
|
||||
if err := client.Start(); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to start client")
|
||||
return
|
||||
}
|
||||
<-client.Done()
|
||||
slog.Info("client disconnected", "client_id", client.ID())
|
||||
}
|
||||
|
||||
// NotFoundHandler is returned when an invalid URL is acccessed
|
||||
|
|
@ -337,27 +369,6 @@ func (a *APIController) FirstRunHandler(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /credentials credentials ListCredentials
|
||||
//
|
||||
// List all credentials.
|
||||
//
|
||||
// Responses:
|
||||
// 200: Credentials
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) ListCredentials(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
creds, err := a.r.ListCredentials(ctx)
|
||||
if err != nil {
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(creds); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /providers providers ListProviders
|
||||
//
|
||||
// List all providers.
|
||||
|
|
@ -420,3 +431,42 @@ func (a *APIController) ControllerInfoHandler(w http.ResponseWriter, r *http.Req
|
|||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:route PUT /controller controller UpdateController
|
||||
//
|
||||
// Update controller.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: Body
|
||||
// description: Parameters used when updating the controller.
|
||||
// type: UpdateControllerParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: ControllerInfo
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) UpdateControllerHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var updateParams runnerParams.UpdateControllerParams
|
||||
if err := json.NewDecoder(r.Body).Decode(&updateParams); err != nil {
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if err := updateParams.Validate(); err != nil {
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
info, err := a.r.UpdateController(ctx, updateParams)
|
||||
if err != nil {
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(info); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
229
apiserver/controllers/credentials.go
Normal file
229
apiserver/controllers/credentials.go
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log/slog"
|
||||
"math"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// swagger:route GET /credentials credentials ListCredentials
|
||||
// swagger:route GET /github/credentials credentials ListCredentials
|
||||
//
|
||||
// List all credentials.
|
||||
//
|
||||
// Responses:
|
||||
// 200: Credentials
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) ListCredentials(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
creds, err := a.r.ListCredentials(ctx)
|
||||
if err != nil {
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(creds); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:route POST /github/credentials credentials CreateCredentials
|
||||
//
|
||||
// Create a GitHub credential.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: Body
|
||||
// description: Parameters used when creating a GitHub credential.
|
||||
// type: CreateGithubCredentialsParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: GithubCredentials
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) CreateGithubCredential(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var params params.CreateGithubCredentialsParams
|
||||
if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to decode request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
cred, err := a.r.CreateGithubCredentials(ctx, params)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to create GitHub credential")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(cred); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /github/credentials/{id} credentials GetCredentials
|
||||
//
|
||||
// Get a GitHub credential.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: id
|
||||
// description: ID of the GitHub credential.
|
||||
// type: integer
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: GithubCredentials
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) GetGithubCredential(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
idParam, ok := vars["id"]
|
||||
if !ok {
|
||||
slog.ErrorContext(ctx, "missing id in request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
id, err := strconv.ParseUint(idParam, 10, 64)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to parse id")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if id > math.MaxUint {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "id is too large")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
cred, err := a.r.GetGithubCredentials(ctx, uint(id))
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to get GitHub credential")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(cred); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:route DELETE /github/credentials/{id} credentials DeleteCredentials
|
||||
//
|
||||
// Delete a GitHub credential.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: id
|
||||
// description: ID of the GitHub credential.
|
||||
// type: integer
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) DeleteGithubCredential(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
idParam, ok := vars["id"]
|
||||
if !ok {
|
||||
slog.ErrorContext(ctx, "missing id in request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
id, err := strconv.ParseUint(idParam, 10, 64)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to parse id")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if id > math.MaxUint {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "id is too large")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if err := a.r.DeleteGithubCredentials(ctx, uint(id)); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to delete GitHub credential")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
// swagger:route PUT /github/credentials/{id} credentials UpdateCredentials
|
||||
//
|
||||
// Update a GitHub credential.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: id
|
||||
// description: ID of the GitHub credential.
|
||||
// type: integer
|
||||
// in: path
|
||||
// required: true
|
||||
// + name: Body
|
||||
// description: Parameters used when updating a GitHub credential.
|
||||
// type: UpdateGithubCredentialsParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: GithubCredentials
|
||||
// 400: APIErrorResponse
|
||||
func (a *APIController) UpdateGithubCredential(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
idParam, ok := vars["id"]
|
||||
if !ok {
|
||||
slog.ErrorContext(ctx, "missing id in request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
id, err := strconv.ParseUint(idParam, 10, 64)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to parse id")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if id > math.MaxUint {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "id is too large")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
var params params.UpdateGithubCredentialsParams
|
||||
if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to decode request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
cred, err := a.r.UpdateGithubCredentials(ctx, uint(id), params)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to update GitHub credential")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(cred); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
186
apiserver/controllers/endpoints.go
Normal file
186
apiserver/controllers/endpoints.go
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// swagger:route POST /github/endpoints endpoints CreateGithubEndpoint
|
||||
//
|
||||
// Create a GitHub Endpoint.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: Body
|
||||
// description: Parameters used when creating a GitHub endpoint.
|
||||
// type: CreateGithubEndpointParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: GithubEndpoint
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) CreateGithubEndpoint(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var params params.CreateGithubEndpointParams
|
||||
if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to decode request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
endpoint, err := a.r.CreateGithubEndpoint(ctx, params)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to create GitHub endpoint")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(endpoint); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /github/endpoints endpoints ListGithubEndpoints
|
||||
//
|
||||
// List all GitHub Endpoints.
|
||||
//
|
||||
// Responses:
|
||||
// 200: GithubEndpoints
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) ListGithubEndpoints(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
endpoints, err := a.r.ListGithubEndpoints(ctx)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to list GitHub endpoints")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(endpoints); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:route GET /github/endpoints/{name} endpoints GetGithubEndpoint
|
||||
//
|
||||
// Get a GitHub Endpoint.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: name
|
||||
// description: The name of the GitHub endpoint.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: GithubEndpoint
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) GetGithubEndpoint(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
vars := mux.Vars(r)
|
||||
name, ok := vars["name"]
|
||||
if !ok {
|
||||
slog.ErrorContext(ctx, "missing name in request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
endpoint, err := a.r.GetGithubEndpoint(ctx, name)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to get GitHub endpoint")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(endpoint); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:route DELETE /github/endpoints/{name} endpoints DeleteGithubEndpoint
|
||||
//
|
||||
// Delete a GitHub Endpoint.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: name
|
||||
// description: The name of the GitHub endpoint.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) DeleteGithubEndpoint(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
vars := mux.Vars(r)
|
||||
name, ok := vars["name"]
|
||||
if !ok {
|
||||
slog.ErrorContext(ctx, "missing name in request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
if err := a.r.DeleteGithubEndpoint(ctx, name); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to delete GitHub endpoint")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
// swagger:route PUT /github/endpoints/{name} endpoints UpdateGithubEndpoint
|
||||
//
|
||||
// Update a GitHub Endpoint.
|
||||
//
|
||||
// Parameters:
|
||||
// + name: name
|
||||
// description: The name of the GitHub endpoint.
|
||||
// type: string
|
||||
// in: path
|
||||
// required: true
|
||||
// + name: Body
|
||||
// description: Parameters used when updating a GitHub endpoint.
|
||||
// type: UpdateGithubEndpointParams
|
||||
// in: body
|
||||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: GithubEndpoint
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) UpdateGithubEndpoint(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
vars := mux.Vars(r)
|
||||
name, ok := vars["name"]
|
||||
if !ok {
|
||||
slog.ErrorContext(ctx, "missing name in request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
var params params.UpdateGithubEndpointParams
|
||||
if err := json.NewDecoder(r.Body).Decode(¶ms); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to decode request")
|
||||
handleError(ctx, w, gErrors.ErrBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
endpoint, err := a.r.UpdateGithubEndpoint(ctx, name, params)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to update GitHub endpoint")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(endpoint); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
}
|
||||
|
|
@ -19,11 +19,11 @@ import (
|
|||
"log/slog"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// swagger:route POST /enterprises enterprises CreateEnterprise
|
||||
|
|
@ -165,7 +165,6 @@ func (a *APIController) DeleteEnterpriseHandler(w http.ResponseWriter, r *http.R
|
|||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
}
|
||||
|
||||
// swagger:route PUT /enterprises/{enterpriseID} enterprises UpdateEnterprise
|
||||
|
|
@ -318,7 +317,6 @@ func (a *APIController) ListEnterprisePoolsHandler(w http.ResponseWriter, r *htt
|
|||
if err := json.NewEncoder(w).Encode(pools); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// swagger:route GET /enterprises/{enterpriseID}/pools/{poolID} enterprises pools GetEnterprisePool
|
||||
|
|
@ -414,7 +412,6 @@ func (a *APIController) DeleteEnterprisePoolHandler(w http.ResponseWriter, r *ht
|
|||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
}
|
||||
|
||||
// swagger:route PUT /enterprises/{enterpriseID}/pools/{poolID} enterprises pools UpdateEnterprisePool
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// swagger:route GET /pools/{poolID}/instances instances ListPoolInstances
|
||||
|
|
@ -128,8 +128,15 @@ func (a *APIController) GetInstanceHandler(w http.ResponseWriter, r *http.Reques
|
|||
// in: query
|
||||
// required: false
|
||||
//
|
||||
// Responses:
|
||||
// default: APIErrorResponse
|
||||
// + name: bypassGHUnauthorized
|
||||
// description: If true GARM will ignore unauthorized errors returned by GitHub when removing a runner. This is useful if you want to clean up runners and your credentials have expired.
|
||||
// type: boolean
|
||||
// in: query
|
||||
// required: false
|
||||
//
|
||||
// Responses:
|
||||
//
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) DeleteInstanceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
vars := mux.Vars(r)
|
||||
|
|
@ -146,7 +153,8 @@ func (a *APIController) DeleteInstanceHandler(w http.ResponseWriter, r *http.Req
|
|||
}
|
||||
|
||||
forceRemove, _ := strconv.ParseBool(r.URL.Query().Get("forceRemove"))
|
||||
if err := a.r.DeleteRunner(ctx, instanceName, forceRemove); err != nil {
|
||||
bypassGHUnauthorized, _ := strconv.ParseBool(r.URL.Query().Get("bypassGHUnauthorized"))
|
||||
if err := a.r.DeleteRunner(ctx, instanceName, forceRemove, bypassGHUnauthorized); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "removing runner")
|
||||
handleError(ctx, w, err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ import (
|
|||
"log/slog"
|
||||
"net/http"
|
||||
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
func (a *APIController) InstanceGithubRegistrationTokenHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// swagger:route POST /organizations organizations CreateOrg
|
||||
|
|
@ -174,7 +174,6 @@ func (a *APIController) DeleteOrgHandler(w http.ResponseWriter, r *http.Request)
|
|||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
}
|
||||
|
||||
// swagger:route PUT /organizations/{orgID} organizations UpdateOrg
|
||||
|
|
@ -423,7 +422,6 @@ func (a *APIController) DeleteOrgPoolHandler(w http.ResponseWriter, r *http.Requ
|
|||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
}
|
||||
|
||||
// swagger:route PUT /organizations/{orgID}/pools/{poolID} organizations pools UpdateOrgPool
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ import (
|
|||
"log/slog"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// swagger:route GET /pools pools ListPools
|
||||
|
|
@ -37,7 +37,6 @@ func (a *APIController) ListAllPoolsHandler(w http.ResponseWriter, r *http.Reque
|
|||
ctx := r.Context()
|
||||
|
||||
pools, err := a.r.ListAllPools(ctx)
|
||||
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "listing pools")
|
||||
handleError(ctx, w, err)
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
gErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/apiserver/params"
|
||||
runnerParams "github.com/cloudbase/garm/params"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// swagger:route POST /repositories repositories CreateRepo
|
||||
|
|
@ -173,7 +173,6 @@ func (a *APIController) DeleteRepoHandler(w http.ResponseWriter, r *http.Request
|
|||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
}
|
||||
|
||||
// swagger:route PUT /repositories/{repoID} repositories UpdateRepo
|
||||
|
|
@ -422,7 +421,6 @@ func (a *APIController) DeleteRepoPoolHandler(w http.ResponseWriter, r *http.Req
|
|||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
}
|
||||
|
||||
// swagger:route PUT /repositories/{repoID}/pools/{poolID} repositories pools UpdateRepoPool
|
||||
|
|
|
|||
181
apiserver/events/events.go
Normal file
181
apiserver/events/events.go
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
package events
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"sync"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
commonUtil "github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/auth"
|
||||
"github.com/cloudbase/garm/database/common"
|
||||
"github.com/cloudbase/garm/database/watcher"
|
||||
"github.com/cloudbase/garm/websocket"
|
||||
)
|
||||
|
||||
func NewHandler(ctx context.Context, client *websocket.Client) (*EventHandler, error) {
|
||||
if client == nil {
|
||||
return nil, runnerErrors.ErrUnauthorized
|
||||
}
|
||||
|
||||
newID := commonUtil.NewID()
|
||||
userID := auth.UserID(ctx)
|
||||
if userID == "" {
|
||||
return nil, runnerErrors.ErrUnauthorized
|
||||
}
|
||||
consumerID := fmt.Sprintf("ws-event-watcher-%s-%s", userID, newID)
|
||||
consumer, err := watcher.RegisterConsumer(
|
||||
// Filter everything by default. Users should set up filters
|
||||
// after registration.
|
||||
ctx, consumerID, watcher.WithNone())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
handler := &EventHandler{
|
||||
client: client,
|
||||
ctx: ctx,
|
||||
consumer: consumer,
|
||||
done: make(chan struct{}),
|
||||
}
|
||||
client.SetMessageHandler(handler.HandleClientMessages)
|
||||
|
||||
return handler, nil
|
||||
}
|
||||
|
||||
type EventHandler struct {
|
||||
client *websocket.Client
|
||||
consumer common.Consumer
|
||||
|
||||
ctx context.Context
|
||||
done chan struct{}
|
||||
running bool
|
||||
|
||||
mux sync.Mutex
|
||||
}
|
||||
|
||||
func (e *EventHandler) loop() {
|
||||
defer e.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-e.ctx.Done():
|
||||
slog.DebugContext(e.ctx, "context done, stopping event handler")
|
||||
return
|
||||
case <-e.client.Done():
|
||||
slog.DebugContext(e.ctx, "client done, stopping event handler")
|
||||
return
|
||||
case <-e.Done():
|
||||
slog.DebugContext(e.ctx, "done channel closed, stopping event handler")
|
||||
case event, ok := <-e.consumer.Watch():
|
||||
if !ok {
|
||||
slog.DebugContext(e.ctx, "watcher closed, stopping event handler")
|
||||
return
|
||||
}
|
||||
asJs, err := json.Marshal(event)
|
||||
if err != nil {
|
||||
slog.ErrorContext(e.ctx, "failed to marshal event", "error", err)
|
||||
continue
|
||||
}
|
||||
if _, err := e.client.Write(asJs); err != nil {
|
||||
slog.ErrorContext(e.ctx, "failed to write event", "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (e *EventHandler) Start() error {
|
||||
e.mux.Lock()
|
||||
defer e.mux.Unlock()
|
||||
|
||||
if e.running {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := e.client.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
e.running = true
|
||||
go e.loop()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *EventHandler) Stop() {
|
||||
e.mux.Lock()
|
||||
defer e.mux.Unlock()
|
||||
|
||||
if !e.running {
|
||||
return
|
||||
}
|
||||
e.running = false
|
||||
e.consumer.Close()
|
||||
e.client.Stop()
|
||||
close(e.done)
|
||||
}
|
||||
|
||||
func (e *EventHandler) Done() <-chan struct{} {
|
||||
return e.done
|
||||
}
|
||||
|
||||
// optionsToWatcherFilters converts the Options struct to a PayloadFilterFunc.
|
||||
// The client will send an array of filters that indicates which entities and which
|
||||
// operations the client is interested in. The behavior is that of "any" filter.
|
||||
// Which means that if any of the elements in the array match an event, it will be
|
||||
// sent to the websocket.
|
||||
// Alternatively, clients can choose to get everything.
|
||||
func (e *EventHandler) optionsToWatcherFilters(opt Options) common.PayloadFilterFunc {
|
||||
if opt.SendEverything {
|
||||
return watcher.WithEverything()
|
||||
}
|
||||
|
||||
var funcs []common.PayloadFilterFunc
|
||||
for _, filter := range opt.Filters {
|
||||
var filterFunc []common.PayloadFilterFunc
|
||||
if filter.EntityType == "" {
|
||||
return watcher.WithNone()
|
||||
}
|
||||
filterFunc = append(filterFunc, watcher.WithEntityTypeFilter(filter.EntityType))
|
||||
if len(filter.Operations) > 0 {
|
||||
var opFunc []common.PayloadFilterFunc
|
||||
for _, op := range filter.Operations {
|
||||
opFunc = append(opFunc, watcher.WithOperationTypeFilter(op))
|
||||
}
|
||||
filterFunc = append(filterFunc, watcher.WithAny(opFunc...))
|
||||
}
|
||||
funcs = append(funcs, watcher.WithAll(filterFunc...))
|
||||
}
|
||||
return watcher.WithAny(funcs...)
|
||||
}
|
||||
|
||||
func (e *EventHandler) HandleClientMessages(message []byte) error {
|
||||
if e.consumer == nil {
|
||||
return fmt.Errorf("consumer not initialized")
|
||||
}
|
||||
|
||||
var opt Options
|
||||
if err := json.Unmarshal(message, &opt); err != nil {
|
||||
slog.ErrorContext(e.ctx, "failed to unmarshal message from client", "error", err, "message", string(message))
|
||||
// Client is in error. Disconnect.
|
||||
e.client.Write([]byte("failed to unmarshal filter"))
|
||||
e.Stop()
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := opt.Validate(); err != nil {
|
||||
if errors.Is(err, common.ErrNoFiltersProvided) {
|
||||
slog.DebugContext(e.ctx, "no filters provided; ignoring")
|
||||
return nil
|
||||
}
|
||||
slog.ErrorContext(e.ctx, "invalid filter", "error", err)
|
||||
e.client.Write([]byte("invalid filter"))
|
||||
e.Stop()
|
||||
return nil
|
||||
}
|
||||
|
||||
watcherFilters := e.optionsToWatcherFilters(opt)
|
||||
e.consumer.SetFilters(watcherFilters)
|
||||
return nil
|
||||
}
|
||||
50
apiserver/events/params.go
Normal file
50
apiserver/events/params.go
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
package events
|
||||
|
||||
import (
|
||||
"github.com/cloudbase/garm/database/common"
|
||||
)
|
||||
|
||||
type Filter struct {
|
||||
Operations []common.OperationType `json:"operations,omitempty" jsonschema:"title=operations,description=A list of operations to filter on,enum=create,enum=update,enum=delete"`
|
||||
EntityType common.DatabaseEntityType `json:"entity-type,omitempty" jsonschema:"title=entity type,description=The type of entity to filter on,enum=repository,enum=organization,enum=enterprise,enum=pool,enum=user,enum=instance,enum=job,enum=controller,enum=github_credentials,enum=github_endpoint"`
|
||||
}
|
||||
|
||||
func (f Filter) Validate() error {
|
||||
switch f.EntityType {
|
||||
case common.RepositoryEntityType, common.OrganizationEntityType, common.EnterpriseEntityType,
|
||||
common.PoolEntityType, common.UserEntityType, common.InstanceEntityType,
|
||||
common.JobEntityType, common.ControllerEntityType, common.GithubCredentialsEntityType,
|
||||
common.GithubEndpointEntityType:
|
||||
default:
|
||||
return common.ErrInvalidEntityType
|
||||
}
|
||||
|
||||
for _, op := range f.Operations {
|
||||
switch op {
|
||||
case common.CreateOperation, common.UpdateOperation, common.DeleteOperation:
|
||||
default:
|
||||
return common.ErrInvalidOperationType
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Options struct {
|
||||
SendEverything bool `json:"send-everything,omitempty" jsonschema:"title=send everything, description=send all events,default=false"`
|
||||
Filters []Filter `json:"filters,omitempty" jsonschema:"title=filters,description=A list of filters to apply to the events. This is ignored when send-everything is true"`
|
||||
}
|
||||
|
||||
func (o Options) Validate() error {
|
||||
if o.SendEverything {
|
||||
return nil
|
||||
}
|
||||
if len(o.Filters) == 0 {
|
||||
return common.ErrNoFiltersProvided
|
||||
}
|
||||
for _, f := range o.Filters {
|
||||
if err := f.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -36,4 +36,9 @@ var (
|
|||
Error: "init_required",
|
||||
Details: "Missing superuser",
|
||||
}
|
||||
// URLsRequired is returned if the controller does not have the required URLs
|
||||
URLsRequired = APIErrorResponse{
|
||||
Error: "urls_required",
|
||||
Details: "Missing required URLs. Make sure you update the metadata, callback and webhook URLs",
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -40,16 +40,16 @@
|
|||
// swagger:meta
|
||||
package routers
|
||||
|
||||
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5 generate spec --input=../swagger-models.yaml --output=../swagger.yaml --include="routers|controllers"
|
||||
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5 validate ../swagger.yaml
|
||||
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 generate spec --input=../swagger-models.yaml --output=../swagger.yaml --include="routers|controllers"
|
||||
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 validate ../swagger.yaml
|
||||
//go:generate rm -rf ../../client
|
||||
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5 generate client --target=../../ --spec=../swagger.yaml
|
||||
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 generate client --target=../../ --spec=../swagger.yaml
|
||||
|
||||
import (
|
||||
_ "expvar" // Register the expvar handlers
|
||||
"log/slog"
|
||||
"net/http"
|
||||
_ "net/http/pprof" // Register the pprof handlers
|
||||
_ "net/http/pprof" //nolint:golangci-lint,gosec // Register the pprof handlers
|
||||
|
||||
"github.com/felixge/httpsnoop"
|
||||
"github.com/gorilla/mux"
|
||||
|
|
@ -87,7 +87,6 @@ func requestLogger(h http.Handler) http.Handler {
|
|||
// gathers metrics from the upstream handlers
|
||||
metrics := httpsnoop.CaptureMetrics(h, w, r)
|
||||
|
||||
//prints log and metrics
|
||||
slog.Info(
|
||||
"access_log",
|
||||
slog.String("method", r.Method),
|
||||
|
|
@ -101,7 +100,7 @@ func requestLogger(h http.Handler) http.Handler {
|
|||
})
|
||||
}
|
||||
|
||||
func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware, instanceMiddleware auth.Middleware, manageWebhooks bool) *mux.Router {
|
||||
func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware, urlsRequiredMiddleware, instanceMiddleware auth.Middleware, manageWebhooks bool) *mux.Router {
|
||||
router := mux.NewRouter()
|
||||
router.Use(requestLogger)
|
||||
|
||||
|
|
@ -153,11 +152,38 @@ func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware
|
|||
authRouter.Handle("/{login:login\\/?}", http.HandlerFunc(han.LoginHandler)).Methods("POST", "OPTIONS")
|
||||
authRouter.Use(initMiddleware.Middleware)
|
||||
|
||||
//////////////////////////
|
||||
// Controller endpoints //
|
||||
//////////////////////////
|
||||
controllerRouter := apiSubRouter.PathPrefix("/controller").Subrouter()
|
||||
// The controller endpoints allow us to get information about the controller and update the URL endpoints.
|
||||
// This endpoint must not be guarded by the urlsRequiredMiddleware as that would prevent the user from
|
||||
// updating the URLs.
|
||||
controllerRouter.Use(initMiddleware.Middleware)
|
||||
controllerRouter.Use(authMiddleware.Middleware)
|
||||
controllerRouter.Use(auth.AdminRequiredMiddleware)
|
||||
// Get controller info
|
||||
controllerRouter.Handle("/", http.HandlerFunc(han.ControllerInfoHandler)).Methods("GET", "OPTIONS")
|
||||
controllerRouter.Handle("", http.HandlerFunc(han.ControllerInfoHandler)).Methods("GET", "OPTIONS")
|
||||
// Update controller
|
||||
controllerRouter.Handle("/", http.HandlerFunc(han.UpdateControllerHandler)).Methods("PUT", "OPTIONS")
|
||||
controllerRouter.Handle("", http.HandlerFunc(han.UpdateControllerHandler)).Methods("PUT", "OPTIONS")
|
||||
|
||||
////////////////////////////////////
|
||||
// API router for everything else //
|
||||
////////////////////////////////////
|
||||
apiRouter := apiSubRouter.PathPrefix("").Subrouter()
|
||||
apiRouter.Use(initMiddleware.Middleware)
|
||||
// all endpoints except the controller endpoint should return an error
|
||||
// if the required metadata, callback and webhook URLs are not set.
|
||||
apiRouter.Use(urlsRequiredMiddleware.Middleware)
|
||||
apiRouter.Use(authMiddleware.Middleware)
|
||||
apiRouter.Use(auth.AdminRequiredMiddleware)
|
||||
|
||||
// Legacy controller path
|
||||
apiRouter.Handle("/controller-info/", http.HandlerFunc(han.ControllerInfoHandler)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/controller-info", http.HandlerFunc(han.ControllerInfoHandler)).Methods("GET", "OPTIONS")
|
||||
|
||||
// Metrics Token
|
||||
apiRouter.Handle("/metrics-token/", http.HandlerFunc(han.MetricsTokenHandler)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/metrics-token", http.HandlerFunc(han.MetricsTokenHandler)).Methods("GET", "OPTIONS")
|
||||
|
|
@ -340,18 +366,63 @@ func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware
|
|||
apiRouter.Handle("/enterprises/", http.HandlerFunc(han.CreateEnterpriseHandler)).Methods("POST", "OPTIONS")
|
||||
apiRouter.Handle("/enterprises", http.HandlerFunc(han.CreateEnterpriseHandler)).Methods("POST", "OPTIONS")
|
||||
|
||||
// Credentials and providers
|
||||
apiRouter.Handle("/credentials/", http.HandlerFunc(han.ListCredentials)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/credentials", http.HandlerFunc(han.ListCredentials)).Methods("GET", "OPTIONS")
|
||||
// Providers
|
||||
apiRouter.Handle("/providers/", http.HandlerFunc(han.ListProviders)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/providers", http.HandlerFunc(han.ListProviders)).Methods("GET", "OPTIONS")
|
||||
|
||||
// Controller info
|
||||
apiRouter.Handle("/controller-info/", http.HandlerFunc(han.ControllerInfoHandler)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/controller-info", http.HandlerFunc(han.ControllerInfoHandler)).Methods("GET", "OPTIONS")
|
||||
//////////////////////
|
||||
// Github Endpoints //
|
||||
//////////////////////
|
||||
// Create Github Endpoint
|
||||
apiRouter.Handle("/github/endpoints/", http.HandlerFunc(han.CreateGithubEndpoint)).Methods("POST", "OPTIONS")
|
||||
apiRouter.Handle("/github/endpoints", http.HandlerFunc(han.CreateGithubEndpoint)).Methods("POST", "OPTIONS")
|
||||
// List Github Endpoints
|
||||
apiRouter.Handle("/github/endpoints/", http.HandlerFunc(han.ListGithubEndpoints)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/github/endpoints", http.HandlerFunc(han.ListGithubEndpoints)).Methods("GET", "OPTIONS")
|
||||
// Get Github Endpoint
|
||||
apiRouter.Handle("/github/endpoints/{name}/", http.HandlerFunc(han.GetGithubEndpoint)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/github/endpoints/{name}", http.HandlerFunc(han.GetGithubEndpoint)).Methods("GET", "OPTIONS")
|
||||
// Delete Github Endpoint
|
||||
apiRouter.Handle("/github/endpoints/{name}/", http.HandlerFunc(han.DeleteGithubEndpoint)).Methods("DELETE", "OPTIONS")
|
||||
apiRouter.Handle("/github/endpoints/{name}", http.HandlerFunc(han.DeleteGithubEndpoint)).Methods("DELETE", "OPTIONS")
|
||||
// Update Github Endpoint
|
||||
apiRouter.Handle("/github/endpoints/{name}/", http.HandlerFunc(han.UpdateGithubEndpoint)).Methods("PUT", "OPTIONS")
|
||||
apiRouter.Handle("/github/endpoints/{name}", http.HandlerFunc(han.UpdateGithubEndpoint)).Methods("PUT", "OPTIONS")
|
||||
|
||||
// Websocket log writer
|
||||
apiRouter.Handle("/{ws:ws\\/?}", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
////////////////////////
|
||||
// Github credentials //
|
||||
////////////////////////
|
||||
// Legacy credentials path
|
||||
apiRouter.Handle("/credentials/", http.HandlerFunc(han.ListCredentials)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/credentials", http.HandlerFunc(han.ListCredentials)).Methods("GET", "OPTIONS")
|
||||
// List Github Credentials
|
||||
apiRouter.Handle("/github/credentials/", http.HandlerFunc(han.ListCredentials)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/github/credentials", http.HandlerFunc(han.ListCredentials)).Methods("GET", "OPTIONS")
|
||||
// Create Github Credentials
|
||||
apiRouter.Handle("/github/credentials/", http.HandlerFunc(han.CreateGithubCredential)).Methods("POST", "OPTIONS")
|
||||
apiRouter.Handle("/github/credentials", http.HandlerFunc(han.CreateGithubCredential)).Methods("POST", "OPTIONS")
|
||||
// Get Github Credential
|
||||
apiRouter.Handle("/github/credentials/{id}/", http.HandlerFunc(han.GetGithubCredential)).Methods("GET", "OPTIONS")
|
||||
apiRouter.Handle("/github/credentials/{id}", http.HandlerFunc(han.GetGithubCredential)).Methods("GET", "OPTIONS")
|
||||
// Delete Github Credential
|
||||
apiRouter.Handle("/github/credentials/{id}/", http.HandlerFunc(han.DeleteGithubCredential)).Methods("DELETE", "OPTIONS")
|
||||
apiRouter.Handle("/github/credentials/{id}", http.HandlerFunc(han.DeleteGithubCredential)).Methods("DELETE", "OPTIONS")
|
||||
// Update Github Credential
|
||||
apiRouter.Handle("/github/credentials/{id}/", http.HandlerFunc(han.UpdateGithubCredential)).Methods("PUT", "OPTIONS")
|
||||
apiRouter.Handle("/github/credentials/{id}", http.HandlerFunc(han.UpdateGithubCredential)).Methods("PUT", "OPTIONS")
|
||||
|
||||
/////////////////////////
|
||||
// Websocket endpoints //
|
||||
/////////////////////////
|
||||
// Legacy log websocket path
|
||||
apiRouter.Handle("/ws/", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
apiRouter.Handle("/ws", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
// Log websocket endpoint
|
||||
apiRouter.Handle("/ws/logs/", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
apiRouter.Handle("/ws/logs", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
// DB watcher websocket endpoint
|
||||
apiRouter.Handle("/ws/events/", http.HandlerFunc(han.EventsHandler)).Methods("GET")
|
||||
apiRouter.Handle("/ws/events", http.HandlerFunc(han.EventsHandler)).Methods("GET")
|
||||
|
||||
// NotFound handler
|
||||
apiRouter.PathPrefix("/").HandlerFunc(han.NotFoundHandler).Methods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
|
|
|
|||
|
|
@ -227,3 +227,61 @@ definitions:
|
|||
import:
|
||||
package: github.com/cloudbase/garm/apiserver/params
|
||||
alias: apiserver_params
|
||||
CreateInstanceParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: CreateInstanceParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
UpdateGithubEndpointParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: UpdateGithubEndpointParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
GithubEndpoint:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: GithubEndpoint
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
GithubEndpoints:
|
||||
type: array
|
||||
x-go-type:
|
||||
type: GithubEndpoints
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
items:
|
||||
$ref: '#/definitions/GithubEndpoint'
|
||||
CreateGithubEndpointParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: CreateGithubEndpointParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
CreateGithubCredentialsParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: CreateGithubCredentialsParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
UpdateGithubCredentialsParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: UpdateGithubCredentialsParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
UpdateControllerParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
type: UpdateControllerParams
|
||||
import:
|
||||
package: github.com/cloudbase/garm/params
|
||||
alias: garm_params
|
||||
|
|
|
|||
|
|
@ -23,6 +23,27 @@ definitions:
|
|||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: CreateEnterpriseParams
|
||||
CreateGithubCredentialsParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: CreateGithubCredentialsParams
|
||||
CreateGithubEndpointParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: CreateGithubEndpointParams
|
||||
CreateInstanceParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: CreateInstanceParams
|
||||
CreateOrgParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
@ -76,6 +97,22 @@ definitions:
|
|||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: GithubCredentials
|
||||
GithubEndpoint:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: GithubEndpoint
|
||||
GithubEndpoints:
|
||||
items:
|
||||
$ref: '#/definitions/GithubEndpoint'
|
||||
type: array
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: GithubEndpoints
|
||||
HookInfo:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
@ -207,6 +244,13 @@ definitions:
|
|||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: Repository
|
||||
UpdateControllerParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: UpdateControllerParams
|
||||
UpdateEntityParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
@ -214,6 +258,20 @@ definitions:
|
|||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: UpdateEntityParams
|
||||
UpdateGithubCredentialsParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: UpdateGithubCredentialsParams
|
||||
UpdateGithubEndpointParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
import:
|
||||
alias: garm_params
|
||||
package: github.com/cloudbase/garm/params
|
||||
type: UpdateGithubEndpointParams
|
||||
UpdatePoolParams:
|
||||
type: object
|
||||
x-go-type:
|
||||
|
|
@ -260,6 +318,30 @@ paths:
|
|||
summary: Logs in a user and returns a JWT token.
|
||||
tags:
|
||||
- login
|
||||
/controller:
|
||||
put:
|
||||
operationId: UpdateController
|
||||
parameters:
|
||||
- description: Parameters used when updating the controller.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/UpdateControllerParams'
|
||||
description: Parameters used when updating the controller.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: ControllerInfo
|
||||
schema:
|
||||
$ref: '#/definitions/ControllerInfo'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Update controller.
|
||||
tags:
|
||||
- controller
|
||||
/controller-info:
|
||||
get:
|
||||
operationId: ControllerInfo
|
||||
|
|
@ -275,21 +357,6 @@ paths:
|
|||
summary: Get controller info.
|
||||
tags:
|
||||
- controllerInfo
|
||||
/credentials:
|
||||
get:
|
||||
operationId: ListCredentials
|
||||
responses:
|
||||
"200":
|
||||
description: Credentials
|
||||
schema:
|
||||
$ref: '#/definitions/Credentials'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List all credentials.
|
||||
tags:
|
||||
- credentials
|
||||
/enterprises:
|
||||
get:
|
||||
operationId: ListEnterprises
|
||||
|
|
@ -573,6 +640,212 @@ paths:
|
|||
summary: Initialize the first run of the controller.
|
||||
tags:
|
||||
- first-run
|
||||
/github/credentials:
|
||||
get:
|
||||
operationId: ListCredentials
|
||||
responses:
|
||||
"200":
|
||||
description: Credentials
|
||||
schema:
|
||||
$ref: '#/definitions/Credentials'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List all credentials.
|
||||
tags:
|
||||
- credentials
|
||||
post:
|
||||
operationId: CreateCredentials
|
||||
parameters:
|
||||
- description: Parameters used when creating a GitHub credential.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/CreateGithubCredentialsParams'
|
||||
description: Parameters used when creating a GitHub credential.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: GithubCredentials
|
||||
schema:
|
||||
$ref: '#/definitions/GithubCredentials'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Create a GitHub credential.
|
||||
tags:
|
||||
- credentials
|
||||
/github/credentials/{id}:
|
||||
delete:
|
||||
operationId: DeleteCredentials
|
||||
parameters:
|
||||
- description: ID of the GitHub credential.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
responses:
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Delete a GitHub credential.
|
||||
tags:
|
||||
- credentials
|
||||
get:
|
||||
operationId: GetCredentials
|
||||
parameters:
|
||||
- description: ID of the GitHub credential.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: GithubCredentials
|
||||
schema:
|
||||
$ref: '#/definitions/GithubCredentials'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Get a GitHub credential.
|
||||
tags:
|
||||
- credentials
|
||||
put:
|
||||
operationId: UpdateCredentials
|
||||
parameters:
|
||||
- description: ID of the GitHub credential.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Parameters used when updating a GitHub credential.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/UpdateGithubCredentialsParams'
|
||||
description: Parameters used when updating a GitHub credential.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: GithubCredentials
|
||||
schema:
|
||||
$ref: '#/definitions/GithubCredentials'
|
||||
"400":
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Update a GitHub credential.
|
||||
tags:
|
||||
- credentials
|
||||
/github/endpoints:
|
||||
get:
|
||||
operationId: ListGithubEndpoints
|
||||
responses:
|
||||
"200":
|
||||
description: GithubEndpoints
|
||||
schema:
|
||||
$ref: '#/definitions/GithubEndpoints'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: List all GitHub Endpoints.
|
||||
tags:
|
||||
- endpoints
|
||||
post:
|
||||
operationId: CreateGithubEndpoint
|
||||
parameters:
|
||||
- description: Parameters used when creating a GitHub endpoint.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/CreateGithubEndpointParams'
|
||||
description: Parameters used when creating a GitHub endpoint.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: GithubEndpoint
|
||||
schema:
|
||||
$ref: '#/definitions/GithubEndpoint'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Create a GitHub Endpoint.
|
||||
tags:
|
||||
- endpoints
|
||||
/github/endpoints/{name}:
|
||||
delete:
|
||||
operationId: DeleteGithubEndpoint
|
||||
parameters:
|
||||
- description: The name of the GitHub endpoint.
|
||||
in: path
|
||||
name: name
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Delete a GitHub Endpoint.
|
||||
tags:
|
||||
- endpoints
|
||||
get:
|
||||
operationId: GetGithubEndpoint
|
||||
parameters:
|
||||
- description: The name of the GitHub endpoint.
|
||||
in: path
|
||||
name: name
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: GithubEndpoint
|
||||
schema:
|
||||
$ref: '#/definitions/GithubEndpoint'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Get a GitHub Endpoint.
|
||||
tags:
|
||||
- endpoints
|
||||
put:
|
||||
operationId: UpdateGithubEndpoint
|
||||
parameters:
|
||||
- description: The name of the GitHub endpoint.
|
||||
in: path
|
||||
name: name
|
||||
required: true
|
||||
type: string
|
||||
- description: Parameters used when updating a GitHub endpoint.
|
||||
in: body
|
||||
name: Body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/UpdateGithubEndpointParams'
|
||||
description: Parameters used when updating a GitHub endpoint.
|
||||
type: object
|
||||
responses:
|
||||
"200":
|
||||
description: GithubEndpoint
|
||||
schema:
|
||||
$ref: '#/definitions/GithubEndpoint'
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
$ref: '#/definitions/APIErrorResponse'
|
||||
summary: Update a GitHub Endpoint.
|
||||
tags:
|
||||
- endpoints
|
||||
/instances:
|
||||
get:
|
||||
operationId: ListInstances
|
||||
|
|
@ -601,6 +874,10 @@ paths:
|
|||
in: query
|
||||
name: forceRemove
|
||||
type: boolean
|
||||
- description: If true GARM will ignore unauthorized errors returned by GitHub when removing a runner. This is useful if you want to clean up runners and your credentials have expired.
|
||||
in: query
|
||||
name: bypassGHUnauthorized
|
||||
type: boolean
|
||||
responses:
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
|
|
|
|||
26
auth/auth.go
26
auth/auth.go
|
|
@ -18,16 +18,16 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
"github.com/nbutton23/zxcvbn-go"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
"github.com/cloudbase/garm/config"
|
||||
"github.com/cloudbase/garm/database/common"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
"github.com/nbutton23/zxcvbn-go"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
func NewAuthenticator(cfg config.JWTAuth, store common.Store) *Authenticator {
|
||||
|
|
@ -55,16 +55,19 @@ func (a *Authenticator) GetJWTToken(ctx context.Context) (string, error) {
|
|||
expires := &jwt.NumericDate{
|
||||
Time: expireToken,
|
||||
}
|
||||
generation := PasswordGeneration(ctx)
|
||||
claims := JWTClaims{
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
ExpiresAt: expires,
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: make this configurable
|
||||
Issuer: "garm",
|
||||
},
|
||||
UserID: UserID(ctx),
|
||||
TokenID: tokenID,
|
||||
IsAdmin: IsAdmin(ctx),
|
||||
FullName: FullName(ctx),
|
||||
UserID: UserID(ctx),
|
||||
TokenID: tokenID,
|
||||
IsAdmin: IsAdmin(ctx),
|
||||
FullName: FullName(ctx),
|
||||
Generation: generation,
|
||||
}
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
tokenString, err := token.SignedString([]byte(a.cfg.Secret))
|
||||
|
|
@ -78,7 +81,6 @@ func (a *Authenticator) GetJWTToken(ctx context.Context) (string, error) {
|
|||
// GetJWTMetricsToken returns a JWT token that can be used to read metrics.
|
||||
// This token is not tied to a user, no user is stored in the db.
|
||||
func (a *Authenticator) GetJWTMetricsToken(ctx context.Context) (string, error) {
|
||||
|
||||
if !IsAdmin(ctx) {
|
||||
return "", runnerErrors.ErrUnauthorized
|
||||
}
|
||||
|
|
@ -87,6 +89,7 @@ func (a *Authenticator) GetJWTMetricsToken(ctx context.Context) (string, error)
|
|||
if err != nil {
|
||||
return "", errors.Wrap(err, "generating random string")
|
||||
}
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: currently this is the same TTL as the normal Token
|
||||
// maybe we should make this configurable
|
||||
// it's usually pretty nasty if the monitoring fails because the token expired
|
||||
|
|
@ -97,6 +100,7 @@ func (a *Authenticator) GetJWTMetricsToken(ctx context.Context) (string, error)
|
|||
claims := JWTClaims{
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
ExpiresAt: expires,
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: make this configurable
|
||||
Issuer: "garm",
|
||||
},
|
||||
|
|
@ -180,5 +184,5 @@ func (a *Authenticator) AuthenticateUser(ctx context.Context, info params.Passwo
|
|||
return ctx, runnerErrors.ErrUnauthorized
|
||||
}
|
||||
|
||||
return PopulateContext(ctx, user), nil
|
||||
return PopulateContext(ctx, user, nil), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package auth
|
|||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
"github.com/cloudbase/garm/params"
|
||||
|
|
@ -28,9 +29,11 @@ const (
|
|||
fullNameKey contextFlags = "full_name"
|
||||
readMetricsKey contextFlags = "read_metrics"
|
||||
// UserIDFlag is the User ID flag we set in the context
|
||||
UserIDFlag contextFlags = "user_id"
|
||||
isEnabledFlag contextFlags = "is_enabled"
|
||||
jwtTokenFlag contextFlags = "jwt_token"
|
||||
UserIDFlag contextFlags = "user_id"
|
||||
isEnabledFlag contextFlags = "is_enabled"
|
||||
jwtTokenFlag contextFlags = "jwt_token"
|
||||
authExpiresFlag contextFlags = "auth_expires"
|
||||
passwordGenerationFlag contextFlags = "password_generation"
|
||||
|
||||
instanceIDKey contextFlags = "id"
|
||||
instanceNameKey contextFlags = "name"
|
||||
|
|
@ -169,14 +172,43 @@ func PopulateInstanceContext(ctx context.Context, instance params.Instance) cont
|
|||
|
||||
// PopulateContext sets the appropriate fields in the context, based on
|
||||
// the user object
|
||||
func PopulateContext(ctx context.Context, user params.User) context.Context {
|
||||
func PopulateContext(ctx context.Context, user params.User, authExpires *time.Time) context.Context {
|
||||
ctx = SetUserID(ctx, user.ID)
|
||||
ctx = SetAdmin(ctx, user.IsAdmin)
|
||||
ctx = SetIsEnabled(ctx, user.Enabled)
|
||||
ctx = SetFullName(ctx, user.FullName)
|
||||
ctx = SetExpires(ctx, authExpires)
|
||||
ctx = SetPasswordGeneration(ctx, user.Generation)
|
||||
return ctx
|
||||
}
|
||||
|
||||
func SetExpires(ctx context.Context, expires *time.Time) context.Context {
|
||||
if expires == nil {
|
||||
return ctx
|
||||
}
|
||||
return context.WithValue(ctx, authExpiresFlag, expires)
|
||||
}
|
||||
|
||||
func Expires(ctx context.Context) *time.Time {
|
||||
elem := ctx.Value(authExpiresFlag)
|
||||
if elem == nil {
|
||||
return nil
|
||||
}
|
||||
return elem.(*time.Time)
|
||||
}
|
||||
|
||||
func SetPasswordGeneration(ctx context.Context, val uint) context.Context {
|
||||
return context.WithValue(ctx, passwordGenerationFlag, val)
|
||||
}
|
||||
|
||||
func PasswordGeneration(ctx context.Context) uint {
|
||||
elem := ctx.Value(passwordGenerationFlag)
|
||||
if elem == nil {
|
||||
return 0
|
||||
}
|
||||
return elem.(uint)
|
||||
}
|
||||
|
||||
// SetFullName sets the user full name in the context
|
||||
func SetFullName(ctx context.Context, fullName string) context.Context {
|
||||
return context.WithValue(ctx, fullNameKey, fullName)
|
||||
|
|
@ -238,8 +270,10 @@ func UserID(ctx context.Context) string {
|
|||
|
||||
// GetAdminContext will return an admin context. This can be used internally
|
||||
// when fetching users.
|
||||
func GetAdminContext() context.Context {
|
||||
ctx := context.Background()
|
||||
func GetAdminContext(ctx context.Context) context.Context {
|
||||
if ctx == nil {
|
||||
ctx = context.Background()
|
||||
}
|
||||
ctx = SetUserID(ctx, "")
|
||||
ctx = SetAdmin(ctx, true)
|
||||
ctx = SetIsEnabled(ctx, true)
|
||||
|
|
|
|||
|
|
@ -51,3 +51,30 @@ func (i *initRequired) Middleware(next http.Handler) http.Handler {
|
|||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
})
|
||||
}
|
||||
|
||||
func NewUrlsRequiredMiddleware(store common.Store) (Middleware, error) {
|
||||
return &urlsRequired{
|
||||
store: store,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type urlsRequired struct {
|
||||
store common.Store
|
||||
}
|
||||
|
||||
func (u *urlsRequired) Middleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
ctrlInfo, err := u.store.ControllerInfo()
|
||||
if err != nil || ctrlInfo.WebhookURL == "" || ctrlInfo.MetadataURL == "" || ctrlInfo.CallbackURL == "" {
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusConflict)
|
||||
if err := json.NewEncoder(w).Encode(params.URLsRequired); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,15 +22,15 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
"github.com/cloudbase/garm/config"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
"github.com/cloudbase/garm/params"
|
||||
"github.com/cloudbase/garm/runner/common"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// InstanceJWTClaims holds JWT claims
|
||||
|
|
@ -39,14 +39,27 @@ type InstanceJWTClaims struct {
|
|||
Name string `json:"name"`
|
||||
PoolID string `json:"provider_id"`
|
||||
// Scope is either repository or organization
|
||||
Scope params.PoolType `json:"scope"`
|
||||
Scope params.GithubEntityType `json:"scope"`
|
||||
// Entity is the repo or org name
|
||||
Entity string `json:"entity"`
|
||||
CreateAttempt int `json:"create_attempt"`
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
func NewInstanceJWTToken(instance params.Instance, secret, entity string, poolType params.PoolType, ttlMinutes uint) (string, error) {
|
||||
func NewInstanceTokenGetter(jwtSecret string) (InstanceTokenGetter, error) {
|
||||
if jwtSecret == "" {
|
||||
return nil, fmt.Errorf("jwt secret is required")
|
||||
}
|
||||
return &instanceToken{
|
||||
jwtSecret: jwtSecret,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type instanceToken struct {
|
||||
jwtSecret string
|
||||
}
|
||||
|
||||
func (i *instanceToken) NewInstanceJWTToken(instance params.Instance, entity string, poolType params.GithubEntityType, ttlMinutes uint) (string, error) {
|
||||
// Token expiration is equal to the bootstrap timeout set on the pool plus the polling
|
||||
// interval garm uses to check for timed out runners. Runners that have not sent their info
|
||||
// by the end of this interval are most likely failed and will be reaped by garm anyway.
|
||||
|
|
@ -67,7 +80,7 @@ func NewInstanceJWTToken(instance params.Instance, secret, entity string, poolTy
|
|||
CreateAttempt: instance.CreateAttempt,
|
||||
}
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
tokenString, err := token.SignedString([]byte(secret))
|
||||
tokenString, err := token.SignedString([]byte(i.jwtSecret))
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "signing token")
|
||||
}
|
||||
|
|
@ -111,6 +124,7 @@ func (amw *instanceMiddleware) claimsToContext(ctx context.Context, claims *Inst
|
|||
// Middleware implements the middleware interface
|
||||
func (amw *instanceMiddleware) Middleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: Log error details when authentication fails
|
||||
ctx := r.Context()
|
||||
authorizationHeader := r.Header.Get("authorization")
|
||||
|
|
@ -132,7 +146,6 @@ func (amw *instanceMiddleware) Middleware(next http.Handler) http.Handler {
|
|||
}
|
||||
return []byte(amw.cfg.Secret), nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
invalidAuthResponse(ctx, w)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -14,9 +14,17 @@
|
|||
|
||||
package auth
|
||||
|
||||
import "net/http"
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// Middleware defines an authentication middleware
|
||||
type Middleware interface {
|
||||
Middleware(next http.Handler) http.Handler
|
||||
}
|
||||
|
||||
type InstanceTokenGetter interface {
|
||||
NewInstanceJWTToken(instance params.Instance, entity string, poolType params.GithubEntityType, ttlMinutes uint) (string, error)
|
||||
}
|
||||
|
|
|
|||
21
auth/jwt.go
21
auth/jwt.go
|
|
@ -21,13 +21,14 @@ import (
|
|||
"log/slog"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
apiParams "github.com/cloudbase/garm/apiserver/params"
|
||||
"github.com/cloudbase/garm/config"
|
||||
dbCommon "github.com/cloudbase/garm/database/common"
|
||||
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
)
|
||||
|
||||
// JWTClaims holds JWT claims
|
||||
|
|
@ -37,6 +38,7 @@ type JWTClaims struct {
|
|||
FullName string `json:"full_name"`
|
||||
IsAdmin bool `json:"is_admin"`
|
||||
ReadMetrics bool `json:"read_metrics"`
|
||||
Generation uint `json:"generation"`
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +71,18 @@ func (amw *jwtMiddleware) claimsToContext(ctx context.Context, claims *JWTClaims
|
|||
return ctx, runnerErrors.ErrUnauthorized
|
||||
}
|
||||
|
||||
ctx = PopulateContext(ctx, userInfo)
|
||||
var expiresAt *time.Time
|
||||
if claims.ExpiresAt != nil {
|
||||
expires := claims.ExpiresAt.Time.UTC()
|
||||
expiresAt = &expires
|
||||
}
|
||||
|
||||
if userInfo.Generation != claims.Generation {
|
||||
// Password was reset since token was issued. Invalidate.
|
||||
return ctx, runnerErrors.ErrUnauthorized
|
||||
}
|
||||
|
||||
ctx = PopulateContext(ctx, userInfo, expiresAt)
|
||||
return ctx, nil
|
||||
}
|
||||
|
||||
|
|
@ -87,6 +100,7 @@ func invalidAuthResponse(ctx context.Context, w http.ResponseWriter) {
|
|||
// Middleware implements the middleware interface
|
||||
func (amw *jwtMiddleware) Middleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// nolint:golangci-lint,godox
|
||||
// TODO: Log error details when authentication fails
|
||||
ctx := r.Context()
|
||||
authorizationHeader := r.Header.Get("authorization")
|
||||
|
|
@ -108,7 +122,6 @@ func (amw *jwtMiddleware) Middleware(next http.Handler) http.Handler {
|
|||
}
|
||||
return []byte(amw.cfg.Secret), nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
invalidAuthResponse(ctx, w)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/cloudbase/garm/config"
|
||||
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
|
||||
"github.com/cloudbase/garm/config"
|
||||
)
|
||||
|
||||
type MetricsMiddleware struct {
|
||||
|
|
@ -23,7 +23,6 @@ func NewMetricsMiddleware(cfg config.JWTAuth) (*MetricsMiddleware, error) {
|
|||
|
||||
func (m *MetricsMiddleware) Middleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
ctx := r.Context()
|
||||
authorizationHeader := r.Header.Get("authorization")
|
||||
if authorizationHeader == "" {
|
||||
|
|
@ -44,7 +43,6 @@ func (m *MetricsMiddleware) Middleware(next http.Handler) http.Handler {
|
|||
}
|
||||
return []byte(m.cfg.Secret), nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
invalidAuthResponse(ctx, w)
|
||||
return
|
||||
|
|
|
|||
106
client/controller/controller_client.go
Normal file
106
client/controller/controller_client.go
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package controller
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new controller API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new controller API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new controller API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for controller API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
UpdateController(params *UpdateControllerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateControllerOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateController updates controller
|
||||
*/
|
||||
func (a *Client) UpdateController(params *UpdateControllerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateControllerOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdateControllerParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UpdateController",
|
||||
Method: "PUT",
|
||||
PathPattern: "/controller",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UpdateControllerReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*UpdateControllerOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for UpdateController: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
151
client/controller/update_controller_parameters.go
Normal file
151
client/controller/update_controller_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package controller
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewUpdateControllerParams creates a new UpdateControllerParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewUpdateControllerParams() *UpdateControllerParams {
|
||||
return &UpdateControllerParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateControllerParamsWithTimeout creates a new UpdateControllerParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUpdateControllerParamsWithTimeout(timeout time.Duration) *UpdateControllerParams {
|
||||
return &UpdateControllerParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateControllerParamsWithContext creates a new UpdateControllerParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUpdateControllerParamsWithContext(ctx context.Context) *UpdateControllerParams {
|
||||
return &UpdateControllerParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateControllerParamsWithHTTPClient creates a new UpdateControllerParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUpdateControllerParamsWithHTTPClient(client *http.Client) *UpdateControllerParams {
|
||||
return &UpdateControllerParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateControllerParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the update controller operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UpdateControllerParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when updating the controller.
|
||||
*/
|
||||
Body garm_params.UpdateControllerParams
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the update controller params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateControllerParams) WithDefaults() *UpdateControllerParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the update controller params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateControllerParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the update controller params
|
||||
func (o *UpdateControllerParams) WithTimeout(timeout time.Duration) *UpdateControllerParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the update controller params
|
||||
func (o *UpdateControllerParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the update controller params
|
||||
func (o *UpdateControllerParams) WithContext(ctx context.Context) *UpdateControllerParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the update controller params
|
||||
func (o *UpdateControllerParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the update controller params
|
||||
func (o *UpdateControllerParams) WithHTTPClient(client *http.Client) *UpdateControllerParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the update controller params
|
||||
func (o *UpdateControllerParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the update controller params
|
||||
func (o *UpdateControllerParams) WithBody(body garm_params.UpdateControllerParams) *UpdateControllerParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the update controller params
|
||||
func (o *UpdateControllerParams) SetBody(body garm_params.UpdateControllerParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UpdateControllerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/controller/update_controller_responses.go
Normal file
179
client/controller/update_controller_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package controller
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// UpdateControllerReader is a Reader for the UpdateController structure.
|
||||
type UpdateControllerReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UpdateControllerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewUpdateControllerOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewUpdateControllerBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[PUT /controller] UpdateController", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateControllerOK creates a UpdateControllerOK with default headers values
|
||||
func NewUpdateControllerOK() *UpdateControllerOK {
|
||||
return &UpdateControllerOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateControllerOK describes a response with status code 200, with default header values.
|
||||
|
||||
ControllerInfo
|
||||
*/
|
||||
type UpdateControllerOK struct {
|
||||
Payload garm_params.ControllerInfo
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update controller o k response has a 2xx status code
|
||||
func (o *UpdateControllerOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update controller o k response has a 3xx status code
|
||||
func (o *UpdateControllerOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update controller o k response has a 4xx status code
|
||||
func (o *UpdateControllerOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update controller o k response has a 5xx status code
|
||||
func (o *UpdateControllerOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update controller o k response a status code equal to that given
|
||||
func (o *UpdateControllerOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the update controller o k response
|
||||
func (o *UpdateControllerOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *UpdateControllerOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /controller][%d] updateControllerOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateControllerOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /controller][%d] updateControllerOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateControllerOK) GetPayload() garm_params.ControllerInfo {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateControllerOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewUpdateControllerBadRequest creates a UpdateControllerBadRequest with default headers values
|
||||
func NewUpdateControllerBadRequest() *UpdateControllerBadRequest {
|
||||
return &UpdateControllerBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateControllerBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UpdateControllerBadRequest struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update controller bad request response has a 2xx status code
|
||||
func (o *UpdateControllerBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update controller bad request response has a 3xx status code
|
||||
func (o *UpdateControllerBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update controller bad request response has a 4xx status code
|
||||
func (o *UpdateControllerBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update controller bad request response has a 5xx status code
|
||||
func (o *UpdateControllerBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update controller bad request response a status code equal to that given
|
||||
func (o *UpdateControllerBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the update controller bad request response
|
||||
func (o *UpdateControllerBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *UpdateControllerBadRequest) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /controller][%d] updateControllerBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateControllerBadRequest) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /controller][%d] updateControllerBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateControllerBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateControllerBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
|
|
@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi
|
|||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new controller info API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new controller info API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for controller info API
|
||||
*/
|
||||
|
|
@ -25,7 +51,7 @@ type Client struct {
|
|||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package controller_info
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -86,11 +87,13 @@ func (o *ControllerInfoOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ControllerInfoOK) Error() string {
|
||||
return fmt.Sprintf("[GET /controller-info][%d] controllerInfoOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /controller-info][%d] controllerInfoOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ControllerInfoOK) String() string {
|
||||
return fmt.Sprintf("[GET /controller-info][%d] controllerInfoOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /controller-info][%d] controllerInfoOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ControllerInfoOK) GetPayload() garm_params.ControllerInfo {
|
||||
|
|
@ -152,11 +155,13 @@ func (o *ControllerInfoConflict) Code() int {
|
|||
}
|
||||
|
||||
func (o *ControllerInfoConflict) Error() string {
|
||||
return fmt.Sprintf("[GET /controller-info][%d] controllerInfoConflict %+v", 409, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /controller-info][%d] controllerInfoConflict %s", 409, payload)
|
||||
}
|
||||
|
||||
func (o *ControllerInfoConflict) String() string {
|
||||
return fmt.Sprintf("[GET /controller-info][%d] controllerInfoConflict %+v", 409, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /controller-info][%d] controllerInfoConflict %s", 409, payload)
|
||||
}
|
||||
|
||||
func (o *ControllerInfoConflict) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
151
client/credentials/create_credentials_parameters.go
Normal file
151
client/credentials/create_credentials_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewCreateCredentialsParams creates a new CreateCredentialsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewCreateCredentialsParams() *CreateCredentialsParams {
|
||||
return &CreateCredentialsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateCredentialsParamsWithTimeout creates a new CreateCredentialsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewCreateCredentialsParamsWithTimeout(timeout time.Duration) *CreateCredentialsParams {
|
||||
return &CreateCredentialsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateCredentialsParamsWithContext creates a new CreateCredentialsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewCreateCredentialsParamsWithContext(ctx context.Context) *CreateCredentialsParams {
|
||||
return &CreateCredentialsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateCredentialsParamsWithHTTPClient creates a new CreateCredentialsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewCreateCredentialsParamsWithHTTPClient(client *http.Client) *CreateCredentialsParams {
|
||||
return &CreateCredentialsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateCredentialsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the create credentials operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type CreateCredentialsParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when creating a GitHub credential.
|
||||
*/
|
||||
Body garm_params.CreateGithubCredentialsParams
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the create credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateCredentialsParams) WithDefaults() *CreateCredentialsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the create credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateCredentialsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the create credentials params
|
||||
func (o *CreateCredentialsParams) WithTimeout(timeout time.Duration) *CreateCredentialsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the create credentials params
|
||||
func (o *CreateCredentialsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the create credentials params
|
||||
func (o *CreateCredentialsParams) WithContext(ctx context.Context) *CreateCredentialsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the create credentials params
|
||||
func (o *CreateCredentialsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the create credentials params
|
||||
func (o *CreateCredentialsParams) WithHTTPClient(client *http.Client) *CreateCredentialsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the create credentials params
|
||||
func (o *CreateCredentialsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the create credentials params
|
||||
func (o *CreateCredentialsParams) WithBody(body garm_params.CreateGithubCredentialsParams) *CreateCredentialsParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the create credentials params
|
||||
func (o *CreateCredentialsParams) SetBody(body garm_params.CreateGithubCredentialsParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *CreateCredentialsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/credentials/create_credentials_responses.go
Normal file
179
client/credentials/create_credentials_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// CreateCredentialsReader is a Reader for the CreateCredentials structure.
|
||||
type CreateCredentialsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *CreateCredentialsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewCreateCredentialsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewCreateCredentialsBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /github/credentials] CreateCredentials", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateCredentialsOK creates a CreateCredentialsOK with default headers values
|
||||
func NewCreateCredentialsOK() *CreateCredentialsOK {
|
||||
return &CreateCredentialsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateCredentialsOK describes a response with status code 200, with default header values.
|
||||
|
||||
GithubCredentials
|
||||
*/
|
||||
type CreateCredentialsOK struct {
|
||||
Payload garm_params.GithubCredentials
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create credentials o k response has a 2xx status code
|
||||
func (o *CreateCredentialsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create credentials o k response has a 3xx status code
|
||||
func (o *CreateCredentialsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create credentials o k response has a 4xx status code
|
||||
func (o *CreateCredentialsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create credentials o k response has a 5xx status code
|
||||
func (o *CreateCredentialsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this create credentials o k response a status code equal to that given
|
||||
func (o *CreateCredentialsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the create credentials o k response
|
||||
func (o *CreateCredentialsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *CreateCredentialsOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /github/credentials][%d] createCredentialsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateCredentialsOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /github/credentials][%d] createCredentialsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateCredentialsOK) GetPayload() garm_params.GithubCredentials {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateCredentialsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewCreateCredentialsBadRequest creates a CreateCredentialsBadRequest with default headers values
|
||||
func NewCreateCredentialsBadRequest() *CreateCredentialsBadRequest {
|
||||
return &CreateCredentialsBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateCredentialsBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type CreateCredentialsBadRequest struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create credentials bad request response has a 2xx status code
|
||||
func (o *CreateCredentialsBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create credentials bad request response has a 3xx status code
|
||||
func (o *CreateCredentialsBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create credentials bad request response has a 4xx status code
|
||||
func (o *CreateCredentialsBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create credentials bad request response has a 5xx status code
|
||||
func (o *CreateCredentialsBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this create credentials bad request response a status code equal to that given
|
||||
func (o *CreateCredentialsBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the create credentials bad request response
|
||||
func (o *CreateCredentialsBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *CreateCredentialsBadRequest) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /github/credentials][%d] createCredentialsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *CreateCredentialsBadRequest) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /github/credentials][%d] createCredentialsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *CreateCredentialsBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateCredentialsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
|
|
@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi
|
|||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new credentials API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new credentials API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for credentials API
|
||||
*/
|
||||
|
|
@ -25,16 +51,134 @@ type Client struct {
|
|||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
CreateCredentials(params *CreateCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCredentialsOK, error)
|
||||
|
||||
DeleteCredentials(params *DeleteCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
||||
|
||||
GetCredentials(params *GetCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCredentialsOK, error)
|
||||
|
||||
ListCredentials(params *ListCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCredentialsOK, error)
|
||||
|
||||
UpdateCredentials(params *UpdateCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCredentialsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
CreateCredentials creates a git hub credential
|
||||
*/
|
||||
func (a *Client) CreateCredentials(params *CreateCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCredentialsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateCredentialsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "CreateCredentials",
|
||||
Method: "POST",
|
||||
PathPattern: "/github/credentials",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &CreateCredentialsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*CreateCredentialsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for CreateCredentials: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteCredentials deletes a git hub credential
|
||||
*/
|
||||
func (a *Client) DeleteCredentials(params *DeleteCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteCredentialsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "DeleteCredentials",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/github/credentials/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &DeleteCredentialsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
_, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
GetCredentials gets a git hub credential
|
||||
*/
|
||||
func (a *Client) GetCredentials(params *GetCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCredentialsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetCredentialsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetCredentials",
|
||||
Method: "GET",
|
||||
PathPattern: "/github/credentials/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetCredentialsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*GetCredentialsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for GetCredentials: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ListCredentials lists all credentials
|
||||
*/
|
||||
|
|
@ -46,7 +190,7 @@ func (a *Client) ListCredentials(params *ListCredentialsParams, authInfo runtime
|
|||
op := &runtime.ClientOperation{
|
||||
ID: "ListCredentials",
|
||||
Method: "GET",
|
||||
PathPattern: "/credentials",
|
||||
PathPattern: "/github/credentials",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
|
|
@ -74,6 +218,45 @@ func (a *Client) ListCredentials(params *ListCredentialsParams, authInfo runtime
|
|||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateCredentials updates a git hub credential
|
||||
*/
|
||||
func (a *Client) UpdateCredentials(params *UpdateCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCredentialsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdateCredentialsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UpdateCredentials",
|
||||
Method: "PUT",
|
||||
PathPattern: "/github/credentials/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UpdateCredentialsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*UpdateCredentialsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for UpdateCredentials: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
|
|
|
|||
152
client/credentials/delete_credentials_parameters.go
Normal file
152
client/credentials/delete_credentials_parameters.go
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewDeleteCredentialsParams creates a new DeleteCredentialsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteCredentialsParams() *DeleteCredentialsParams {
|
||||
return &DeleteCredentialsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteCredentialsParamsWithTimeout creates a new DeleteCredentialsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteCredentialsParamsWithTimeout(timeout time.Duration) *DeleteCredentialsParams {
|
||||
return &DeleteCredentialsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteCredentialsParamsWithContext creates a new DeleteCredentialsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteCredentialsParamsWithContext(ctx context.Context) *DeleteCredentialsParams {
|
||||
return &DeleteCredentialsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteCredentialsParamsWithHTTPClient creates a new DeleteCredentialsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteCredentialsParamsWithHTTPClient(client *http.Client) *DeleteCredentialsParams {
|
||||
return &DeleteCredentialsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteCredentialsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete credentials operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteCredentialsParams struct {
|
||||
|
||||
/* ID.
|
||||
|
||||
ID of the GitHub credential.
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteCredentialsParams) WithDefaults() *DeleteCredentialsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteCredentialsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete credentials params
|
||||
func (o *DeleteCredentialsParams) WithTimeout(timeout time.Duration) *DeleteCredentialsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the delete credentials params
|
||||
func (o *DeleteCredentialsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the delete credentials params
|
||||
func (o *DeleteCredentialsParams) WithContext(ctx context.Context) *DeleteCredentialsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the delete credentials params
|
||||
func (o *DeleteCredentialsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the delete credentials params
|
||||
func (o *DeleteCredentialsParams) WithHTTPClient(client *http.Client) *DeleteCredentialsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the delete credentials params
|
||||
func (o *DeleteCredentialsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the delete credentials params
|
||||
func (o *DeleteCredentialsParams) WithID(id int64) *DeleteCredentialsParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the delete credentials params
|
||||
func (o *DeleteCredentialsParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DeleteCredentialsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
106
client/credentials/delete_credentials_responses.go
Normal file
106
client/credentials/delete_credentials_responses.go
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// DeleteCredentialsReader is a Reader for the DeleteCredentials structure.
|
||||
type DeleteCredentialsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DeleteCredentialsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
result := NewDeleteCredentialsDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
|
||||
// NewDeleteCredentialsDefault creates a DeleteCredentialsDefault with default headers values
|
||||
func NewDeleteCredentialsDefault(code int) *DeleteCredentialsDefault {
|
||||
return &DeleteCredentialsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteCredentialsDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type DeleteCredentialsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete credentials default response has a 2xx status code
|
||||
func (o *DeleteCredentialsDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete credentials default response has a 3xx status code
|
||||
func (o *DeleteCredentialsDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete credentials default response has a 4xx status code
|
||||
func (o *DeleteCredentialsDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete credentials default response has a 5xx status code
|
||||
func (o *DeleteCredentialsDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete credentials default response a status code equal to that given
|
||||
func (o *DeleteCredentialsDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the delete credentials default response
|
||||
func (o *DeleteCredentialsDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *DeleteCredentialsDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /github/credentials/{id}][%d] DeleteCredentials default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteCredentialsDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /github/credentials/{id}][%d] DeleteCredentials default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteCredentialsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DeleteCredentialsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
152
client/credentials/get_credentials_parameters.go
Normal file
152
client/credentials/get_credentials_parameters.go
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewGetCredentialsParams creates a new GetCredentialsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetCredentialsParams() *GetCredentialsParams {
|
||||
return &GetCredentialsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetCredentialsParamsWithTimeout creates a new GetCredentialsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetCredentialsParamsWithTimeout(timeout time.Duration) *GetCredentialsParams {
|
||||
return &GetCredentialsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetCredentialsParamsWithContext creates a new GetCredentialsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetCredentialsParamsWithContext(ctx context.Context) *GetCredentialsParams {
|
||||
return &GetCredentialsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetCredentialsParamsWithHTTPClient creates a new GetCredentialsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetCredentialsParamsWithHTTPClient(client *http.Client) *GetCredentialsParams {
|
||||
return &GetCredentialsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetCredentialsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get credentials operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetCredentialsParams struct {
|
||||
|
||||
/* ID.
|
||||
|
||||
ID of the GitHub credential.
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetCredentialsParams) WithDefaults() *GetCredentialsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetCredentialsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get credentials params
|
||||
func (o *GetCredentialsParams) WithTimeout(timeout time.Duration) *GetCredentialsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get credentials params
|
||||
func (o *GetCredentialsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get credentials params
|
||||
func (o *GetCredentialsParams) WithContext(ctx context.Context) *GetCredentialsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get credentials params
|
||||
func (o *GetCredentialsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get credentials params
|
||||
func (o *GetCredentialsParams) WithHTTPClient(client *http.Client) *GetCredentialsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get credentials params
|
||||
func (o *GetCredentialsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the get credentials params
|
||||
func (o *GetCredentialsParams) WithID(id int64) *GetCredentialsParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the get credentials params
|
||||
func (o *GetCredentialsParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetCredentialsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/credentials/get_credentials_responses.go
Normal file
179
client/credentials/get_credentials_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// GetCredentialsReader is a Reader for the GetCredentials structure.
|
||||
type GetCredentialsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetCredentialsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetCredentialsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewGetCredentialsBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /github/credentials/{id}] GetCredentials", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetCredentialsOK creates a GetCredentialsOK with default headers values
|
||||
func NewGetCredentialsOK() *GetCredentialsOK {
|
||||
return &GetCredentialsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetCredentialsOK describes a response with status code 200, with default header values.
|
||||
|
||||
GithubCredentials
|
||||
*/
|
||||
type GetCredentialsOK struct {
|
||||
Payload garm_params.GithubCredentials
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get credentials o k response has a 2xx status code
|
||||
func (o *GetCredentialsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get credentials o k response has a 3xx status code
|
||||
func (o *GetCredentialsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get credentials o k response has a 4xx status code
|
||||
func (o *GetCredentialsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get credentials o k response has a 5xx status code
|
||||
func (o *GetCredentialsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get credentials o k response a status code equal to that given
|
||||
func (o *GetCredentialsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get credentials o k response
|
||||
func (o *GetCredentialsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetCredentialsOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/credentials/{id}][%d] getCredentialsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetCredentialsOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/credentials/{id}][%d] getCredentialsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetCredentialsOK) GetPayload() garm_params.GithubCredentials {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetCredentialsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetCredentialsBadRequest creates a GetCredentialsBadRequest with default headers values
|
||||
func NewGetCredentialsBadRequest() *GetCredentialsBadRequest {
|
||||
return &GetCredentialsBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetCredentialsBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type GetCredentialsBadRequest struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get credentials bad request response has a 2xx status code
|
||||
func (o *GetCredentialsBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get credentials bad request response has a 3xx status code
|
||||
func (o *GetCredentialsBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get credentials bad request response has a 4xx status code
|
||||
func (o *GetCredentialsBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get credentials bad request response has a 5xx status code
|
||||
func (o *GetCredentialsBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get credentials bad request response a status code equal to that given
|
||||
func (o *GetCredentialsBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the get credentials bad request response
|
||||
func (o *GetCredentialsBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *GetCredentialsBadRequest) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/credentials/{id}][%d] getCredentialsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *GetCredentialsBadRequest) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/credentials/{id}][%d] getCredentialsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *GetCredentialsBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetCredentialsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ package credentials
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -37,7 +38,7 @@ func (o *ListCredentialsReader) ReadResponse(response runtime.ClientResponse, co
|
|||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /credentials] ListCredentials", response, response.Code())
|
||||
return nil, runtime.NewAPIError("[GET /github/credentials] ListCredentials", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,11 +87,13 @@ func (o *ListCredentialsOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListCredentialsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /credentials][%d] listCredentialsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/credentials][%d] listCredentialsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListCredentialsOK) String() string {
|
||||
return fmt.Sprintf("[GET /credentials][%d] listCredentialsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/credentials][%d] listCredentialsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListCredentialsOK) GetPayload() garm_params.Credentials {
|
||||
|
|
@ -152,11 +155,13 @@ func (o *ListCredentialsBadRequest) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListCredentialsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /credentials][%d] listCredentialsBadRequest %+v", 400, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/credentials][%d] listCredentialsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *ListCredentialsBadRequest) String() string {
|
||||
return fmt.Sprintf("[GET /credentials][%d] listCredentialsBadRequest %+v", 400, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/credentials][%d] listCredentialsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *ListCredentialsBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
174
client/credentials/update_credentials_parameters.go
Normal file
174
client/credentials/update_credentials_parameters.go
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewUpdateCredentialsParams creates a new UpdateCredentialsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewUpdateCredentialsParams() *UpdateCredentialsParams {
|
||||
return &UpdateCredentialsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateCredentialsParamsWithTimeout creates a new UpdateCredentialsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUpdateCredentialsParamsWithTimeout(timeout time.Duration) *UpdateCredentialsParams {
|
||||
return &UpdateCredentialsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateCredentialsParamsWithContext creates a new UpdateCredentialsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUpdateCredentialsParamsWithContext(ctx context.Context) *UpdateCredentialsParams {
|
||||
return &UpdateCredentialsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateCredentialsParamsWithHTTPClient creates a new UpdateCredentialsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUpdateCredentialsParamsWithHTTPClient(client *http.Client) *UpdateCredentialsParams {
|
||||
return &UpdateCredentialsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateCredentialsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the update credentials operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UpdateCredentialsParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when updating a GitHub credential.
|
||||
*/
|
||||
Body garm_params.UpdateGithubCredentialsParams
|
||||
|
||||
/* ID.
|
||||
|
||||
ID of the GitHub credential.
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the update credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateCredentialsParams) WithDefaults() *UpdateCredentialsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the update credentials params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateCredentialsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the update credentials params
|
||||
func (o *UpdateCredentialsParams) WithTimeout(timeout time.Duration) *UpdateCredentialsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the update credentials params
|
||||
func (o *UpdateCredentialsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the update credentials params
|
||||
func (o *UpdateCredentialsParams) WithContext(ctx context.Context) *UpdateCredentialsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the update credentials params
|
||||
func (o *UpdateCredentialsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the update credentials params
|
||||
func (o *UpdateCredentialsParams) WithHTTPClient(client *http.Client) *UpdateCredentialsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the update credentials params
|
||||
func (o *UpdateCredentialsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the update credentials params
|
||||
func (o *UpdateCredentialsParams) WithBody(body garm_params.UpdateGithubCredentialsParams) *UpdateCredentialsParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the update credentials params
|
||||
func (o *UpdateCredentialsParams) SetBody(body garm_params.UpdateGithubCredentialsParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithID adds the id to the update credentials params
|
||||
func (o *UpdateCredentialsParams) WithID(id int64) *UpdateCredentialsParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the update credentials params
|
||||
func (o *UpdateCredentialsParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UpdateCredentialsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
179
client/credentials/update_credentials_responses.go
Normal file
179
client/credentials/update_credentials_responses.go
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package credentials
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// UpdateCredentialsReader is a Reader for the UpdateCredentials structure.
|
||||
type UpdateCredentialsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UpdateCredentialsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewUpdateCredentialsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewUpdateCredentialsBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[PUT /github/credentials/{id}] UpdateCredentials", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateCredentialsOK creates a UpdateCredentialsOK with default headers values
|
||||
func NewUpdateCredentialsOK() *UpdateCredentialsOK {
|
||||
return &UpdateCredentialsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateCredentialsOK describes a response with status code 200, with default header values.
|
||||
|
||||
GithubCredentials
|
||||
*/
|
||||
type UpdateCredentialsOK struct {
|
||||
Payload garm_params.GithubCredentials
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update credentials o k response has a 2xx status code
|
||||
func (o *UpdateCredentialsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update credentials o k response has a 3xx status code
|
||||
func (o *UpdateCredentialsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update credentials o k response has a 4xx status code
|
||||
func (o *UpdateCredentialsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update credentials o k response has a 5xx status code
|
||||
func (o *UpdateCredentialsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update credentials o k response a status code equal to that given
|
||||
func (o *UpdateCredentialsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the update credentials o k response
|
||||
func (o *UpdateCredentialsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *UpdateCredentialsOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /github/credentials/{id}][%d] updateCredentialsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateCredentialsOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /github/credentials/{id}][%d] updateCredentialsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateCredentialsOK) GetPayload() garm_params.GithubCredentials {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateCredentialsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewUpdateCredentialsBadRequest creates a UpdateCredentialsBadRequest with default headers values
|
||||
func NewUpdateCredentialsBadRequest() *UpdateCredentialsBadRequest {
|
||||
return &UpdateCredentialsBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateCredentialsBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UpdateCredentialsBadRequest struct {
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update credentials bad request response has a 2xx status code
|
||||
func (o *UpdateCredentialsBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update credentials bad request response has a 3xx status code
|
||||
func (o *UpdateCredentialsBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update credentials bad request response has a 4xx status code
|
||||
func (o *UpdateCredentialsBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update credentials bad request response has a 5xx status code
|
||||
func (o *UpdateCredentialsBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update credentials bad request response a status code equal to that given
|
||||
func (o *UpdateCredentialsBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the update credentials bad request response
|
||||
func (o *UpdateCredentialsBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *UpdateCredentialsBadRequest) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /github/credentials/{id}][%d] updateCredentialsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateCredentialsBadRequest) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /github/credentials/{id}][%d] updateCredentialsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateCredentialsBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateCredentialsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/endpoints/create_github_endpoint_parameters.go
Normal file
151
client/endpoints/create_github_endpoint_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewCreateGithubEndpointParams creates a new CreateGithubEndpointParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewCreateGithubEndpointParams() *CreateGithubEndpointParams {
|
||||
return &CreateGithubEndpointParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateGithubEndpointParamsWithTimeout creates a new CreateGithubEndpointParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewCreateGithubEndpointParamsWithTimeout(timeout time.Duration) *CreateGithubEndpointParams {
|
||||
return &CreateGithubEndpointParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateGithubEndpointParamsWithContext creates a new CreateGithubEndpointParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewCreateGithubEndpointParamsWithContext(ctx context.Context) *CreateGithubEndpointParams {
|
||||
return &CreateGithubEndpointParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateGithubEndpointParamsWithHTTPClient creates a new CreateGithubEndpointParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewCreateGithubEndpointParamsWithHTTPClient(client *http.Client) *CreateGithubEndpointParams {
|
||||
return &CreateGithubEndpointParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateGithubEndpointParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the create github endpoint operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type CreateGithubEndpointParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when creating a GitHub endpoint.
|
||||
*/
|
||||
Body garm_params.CreateGithubEndpointParams
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the create github endpoint params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateGithubEndpointParams) WithDefaults() *CreateGithubEndpointParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the create github endpoint params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *CreateGithubEndpointParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the create github endpoint params
|
||||
func (o *CreateGithubEndpointParams) WithTimeout(timeout time.Duration) *CreateGithubEndpointParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the create github endpoint params
|
||||
func (o *CreateGithubEndpointParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the create github endpoint params
|
||||
func (o *CreateGithubEndpointParams) WithContext(ctx context.Context) *CreateGithubEndpointParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the create github endpoint params
|
||||
func (o *CreateGithubEndpointParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the create github endpoint params
|
||||
func (o *CreateGithubEndpointParams) WithHTTPClient(client *http.Client) *CreateGithubEndpointParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the create github endpoint params
|
||||
func (o *CreateGithubEndpointParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the create github endpoint params
|
||||
func (o *CreateGithubEndpointParams) WithBody(body garm_params.CreateGithubEndpointParams) *CreateGithubEndpointParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the create github endpoint params
|
||||
func (o *CreateGithubEndpointParams) SetBody(body garm_params.CreateGithubEndpointParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *CreateGithubEndpointParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
184
client/endpoints/create_github_endpoint_responses.go
Normal file
184
client/endpoints/create_github_endpoint_responses.go
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// CreateGithubEndpointReader is a Reader for the CreateGithubEndpoint structure.
|
||||
type CreateGithubEndpointReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *CreateGithubEndpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewCreateGithubEndpointOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewCreateGithubEndpointDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateGithubEndpointOK creates a CreateGithubEndpointOK with default headers values
|
||||
func NewCreateGithubEndpointOK() *CreateGithubEndpointOK {
|
||||
return &CreateGithubEndpointOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateGithubEndpointOK describes a response with status code 200, with default header values.
|
||||
|
||||
GithubEndpoint
|
||||
*/
|
||||
type CreateGithubEndpointOK struct {
|
||||
Payload garm_params.GithubEndpoint
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create github endpoint o k response has a 2xx status code
|
||||
func (o *CreateGithubEndpointOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create github endpoint o k response has a 3xx status code
|
||||
func (o *CreateGithubEndpointOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create github endpoint o k response has a 4xx status code
|
||||
func (o *CreateGithubEndpointOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create github endpoint o k response has a 5xx status code
|
||||
func (o *CreateGithubEndpointOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this create github endpoint o k response a status code equal to that given
|
||||
func (o *CreateGithubEndpointOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the create github endpoint o k response
|
||||
func (o *CreateGithubEndpointOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *CreateGithubEndpointOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /github/endpoints][%d] createGithubEndpointOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateGithubEndpointOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /github/endpoints][%d] createGithubEndpointOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateGithubEndpointOK) GetPayload() garm_params.GithubEndpoint {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateGithubEndpointOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewCreateGithubEndpointDefault creates a CreateGithubEndpointDefault with default headers values
|
||||
func NewCreateGithubEndpointDefault(code int) *CreateGithubEndpointDefault {
|
||||
return &CreateGithubEndpointDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CreateGithubEndpointDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type CreateGithubEndpointDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this create github endpoint default response has a 2xx status code
|
||||
func (o *CreateGithubEndpointDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this create github endpoint default response has a 3xx status code
|
||||
func (o *CreateGithubEndpointDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this create github endpoint default response has a 4xx status code
|
||||
func (o *CreateGithubEndpointDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this create github endpoint default response has a 5xx status code
|
||||
func (o *CreateGithubEndpointDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this create github endpoint default response a status code equal to that given
|
||||
func (o *CreateGithubEndpointDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the create github endpoint default response
|
||||
func (o *CreateGithubEndpointDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *CreateGithubEndpointDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /github/endpoints][%d] CreateGithubEndpoint default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateGithubEndpointDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /github/endpoints][%d] CreateGithubEndpoint default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateGithubEndpointDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *CreateGithubEndpointDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
151
client/endpoints/delete_github_endpoint_parameters.go
Normal file
151
client/endpoints/delete_github_endpoint_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteGithubEndpointParams creates a new DeleteGithubEndpointParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewDeleteGithubEndpointParams() *DeleteGithubEndpointParams {
|
||||
return &DeleteGithubEndpointParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteGithubEndpointParamsWithTimeout creates a new DeleteGithubEndpointParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteGithubEndpointParamsWithTimeout(timeout time.Duration) *DeleteGithubEndpointParams {
|
||||
return &DeleteGithubEndpointParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteGithubEndpointParamsWithContext creates a new DeleteGithubEndpointParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteGithubEndpointParamsWithContext(ctx context.Context) *DeleteGithubEndpointParams {
|
||||
return &DeleteGithubEndpointParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteGithubEndpointParamsWithHTTPClient creates a new DeleteGithubEndpointParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteGithubEndpointParamsWithHTTPClient(client *http.Client) *DeleteGithubEndpointParams {
|
||||
return &DeleteGithubEndpointParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteGithubEndpointParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete github endpoint operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteGithubEndpointParams struct {
|
||||
|
||||
/* Name.
|
||||
|
||||
The name of the GitHub endpoint.
|
||||
*/
|
||||
Name string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete github endpoint params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteGithubEndpointParams) WithDefaults() *DeleteGithubEndpointParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete github endpoint params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteGithubEndpointParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete github endpoint params
|
||||
func (o *DeleteGithubEndpointParams) WithTimeout(timeout time.Duration) *DeleteGithubEndpointParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the delete github endpoint params
|
||||
func (o *DeleteGithubEndpointParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the delete github endpoint params
|
||||
func (o *DeleteGithubEndpointParams) WithContext(ctx context.Context) *DeleteGithubEndpointParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the delete github endpoint params
|
||||
func (o *DeleteGithubEndpointParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the delete github endpoint params
|
||||
func (o *DeleteGithubEndpointParams) WithHTTPClient(client *http.Client) *DeleteGithubEndpointParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the delete github endpoint params
|
||||
func (o *DeleteGithubEndpointParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithName adds the name to the delete github endpoint params
|
||||
func (o *DeleteGithubEndpointParams) WithName(name string) *DeleteGithubEndpointParams {
|
||||
o.SetName(name)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetName adds the name to the delete github endpoint params
|
||||
func (o *DeleteGithubEndpointParams) SetName(name string) {
|
||||
o.Name = name
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DeleteGithubEndpointParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param name
|
||||
if err := r.SetPathParam("name", o.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
106
client/endpoints/delete_github_endpoint_responses.go
Normal file
106
client/endpoints/delete_github_endpoint_responses.go
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// DeleteGithubEndpointReader is a Reader for the DeleteGithubEndpoint structure.
|
||||
type DeleteGithubEndpointReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DeleteGithubEndpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
result := NewDeleteGithubEndpointDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
|
||||
// NewDeleteGithubEndpointDefault creates a DeleteGithubEndpointDefault with default headers values
|
||||
func NewDeleteGithubEndpointDefault(code int) *DeleteGithubEndpointDefault {
|
||||
return &DeleteGithubEndpointDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteGithubEndpointDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type DeleteGithubEndpointDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete github endpoint default response has a 2xx status code
|
||||
func (o *DeleteGithubEndpointDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete github endpoint default response has a 3xx status code
|
||||
func (o *DeleteGithubEndpointDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete github endpoint default response has a 4xx status code
|
||||
func (o *DeleteGithubEndpointDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete github endpoint default response has a 5xx status code
|
||||
func (o *DeleteGithubEndpointDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete github endpoint default response a status code equal to that given
|
||||
func (o *DeleteGithubEndpointDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the delete github endpoint default response
|
||||
func (o *DeleteGithubEndpointDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *DeleteGithubEndpointDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /github/endpoints/{name}][%d] DeleteGithubEndpoint default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteGithubEndpointDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /github/endpoints/{name}][%d] DeleteGithubEndpoint default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteGithubEndpointDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *DeleteGithubEndpointDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
257
client/endpoints/endpoints_client.go
Normal file
257
client/endpoints/endpoints_client.go
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new endpoints API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new endpoints API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new endpoints API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for endpoints API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
CreateGithubEndpoint(params *CreateGithubEndpointParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateGithubEndpointOK, error)
|
||||
|
||||
DeleteGithubEndpoint(params *DeleteGithubEndpointParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
||||
|
||||
GetGithubEndpoint(params *GetGithubEndpointParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGithubEndpointOK, error)
|
||||
|
||||
ListGithubEndpoints(params *ListGithubEndpointsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListGithubEndpointsOK, error)
|
||||
|
||||
UpdateGithubEndpoint(params *UpdateGithubEndpointParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateGithubEndpointOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
CreateGithubEndpoint creates a git hub endpoint
|
||||
*/
|
||||
func (a *Client) CreateGithubEndpoint(params *CreateGithubEndpointParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateGithubEndpointOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewCreateGithubEndpointParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "CreateGithubEndpoint",
|
||||
Method: "POST",
|
||||
PathPattern: "/github/endpoints",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &CreateGithubEndpointReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*CreateGithubEndpointOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*CreateGithubEndpointDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteGithubEndpoint deletes a git hub endpoint
|
||||
*/
|
||||
func (a *Client) DeleteGithubEndpoint(params *DeleteGithubEndpointParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteGithubEndpointParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "DeleteGithubEndpoint",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/github/endpoints/{name}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &DeleteGithubEndpointReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
_, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
GetGithubEndpoint gets a git hub endpoint
|
||||
*/
|
||||
func (a *Client) GetGithubEndpoint(params *GetGithubEndpointParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGithubEndpointOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetGithubEndpointParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetGithubEndpoint",
|
||||
Method: "GET",
|
||||
PathPattern: "/github/endpoints/{name}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetGithubEndpointReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*GetGithubEndpointOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*GetGithubEndpointDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListGithubEndpoints lists all git hub endpoints
|
||||
*/
|
||||
func (a *Client) ListGithubEndpoints(params *ListGithubEndpointsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListGithubEndpointsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListGithubEndpointsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ListGithubEndpoints",
|
||||
Method: "GET",
|
||||
PathPattern: "/github/endpoints",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListGithubEndpointsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListGithubEndpointsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ListGithubEndpointsDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateGithubEndpoint updates a git hub endpoint
|
||||
*/
|
||||
func (a *Client) UpdateGithubEndpoint(params *UpdateGithubEndpointParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateGithubEndpointOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUpdateGithubEndpointParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UpdateGithubEndpoint",
|
||||
Method: "PUT",
|
||||
PathPattern: "/github/endpoints/{name}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UpdateGithubEndpointReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*UpdateGithubEndpointOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*UpdateGithubEndpointDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
||||
151
client/endpoints/get_github_endpoint_parameters.go
Normal file
151
client/endpoints/get_github_endpoint_parameters.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetGithubEndpointParams creates a new GetGithubEndpointParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewGetGithubEndpointParams() *GetGithubEndpointParams {
|
||||
return &GetGithubEndpointParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetGithubEndpointParamsWithTimeout creates a new GetGithubEndpointParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetGithubEndpointParamsWithTimeout(timeout time.Duration) *GetGithubEndpointParams {
|
||||
return &GetGithubEndpointParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetGithubEndpointParamsWithContext creates a new GetGithubEndpointParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetGithubEndpointParamsWithContext(ctx context.Context) *GetGithubEndpointParams {
|
||||
return &GetGithubEndpointParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetGithubEndpointParamsWithHTTPClient creates a new GetGithubEndpointParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetGithubEndpointParamsWithHTTPClient(client *http.Client) *GetGithubEndpointParams {
|
||||
return &GetGithubEndpointParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetGithubEndpointParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get github endpoint operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetGithubEndpointParams struct {
|
||||
|
||||
/* Name.
|
||||
|
||||
The name of the GitHub endpoint.
|
||||
*/
|
||||
Name string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get github endpoint params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetGithubEndpointParams) WithDefaults() *GetGithubEndpointParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get github endpoint params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetGithubEndpointParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get github endpoint params
|
||||
func (o *GetGithubEndpointParams) WithTimeout(timeout time.Duration) *GetGithubEndpointParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get github endpoint params
|
||||
func (o *GetGithubEndpointParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get github endpoint params
|
||||
func (o *GetGithubEndpointParams) WithContext(ctx context.Context) *GetGithubEndpointParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get github endpoint params
|
||||
func (o *GetGithubEndpointParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get github endpoint params
|
||||
func (o *GetGithubEndpointParams) WithHTTPClient(client *http.Client) *GetGithubEndpointParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get github endpoint params
|
||||
func (o *GetGithubEndpointParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithName adds the name to the get github endpoint params
|
||||
func (o *GetGithubEndpointParams) WithName(name string) *GetGithubEndpointParams {
|
||||
o.SetName(name)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetName adds the name to the get github endpoint params
|
||||
func (o *GetGithubEndpointParams) SetName(name string) {
|
||||
o.Name = name
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetGithubEndpointParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param name
|
||||
if err := r.SetPathParam("name", o.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
184
client/endpoints/get_github_endpoint_responses.go
Normal file
184
client/endpoints/get_github_endpoint_responses.go
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// GetGithubEndpointReader is a Reader for the GetGithubEndpoint structure.
|
||||
type GetGithubEndpointReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetGithubEndpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetGithubEndpointOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewGetGithubEndpointDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetGithubEndpointOK creates a GetGithubEndpointOK with default headers values
|
||||
func NewGetGithubEndpointOK() *GetGithubEndpointOK {
|
||||
return &GetGithubEndpointOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetGithubEndpointOK describes a response with status code 200, with default header values.
|
||||
|
||||
GithubEndpoint
|
||||
*/
|
||||
type GetGithubEndpointOK struct {
|
||||
Payload garm_params.GithubEndpoint
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get github endpoint o k response has a 2xx status code
|
||||
func (o *GetGithubEndpointOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get github endpoint o k response has a 3xx status code
|
||||
func (o *GetGithubEndpointOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get github endpoint o k response has a 4xx status code
|
||||
func (o *GetGithubEndpointOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get github endpoint o k response has a 5xx status code
|
||||
func (o *GetGithubEndpointOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get github endpoint o k response a status code equal to that given
|
||||
func (o *GetGithubEndpointOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the get github endpoint o k response
|
||||
func (o *GetGithubEndpointOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *GetGithubEndpointOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/endpoints/{name}][%d] getGithubEndpointOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetGithubEndpointOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/endpoints/{name}][%d] getGithubEndpointOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetGithubEndpointOK) GetPayload() garm_params.GithubEndpoint {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetGithubEndpointOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewGetGithubEndpointDefault creates a GetGithubEndpointDefault with default headers values
|
||||
func NewGetGithubEndpointDefault(code int) *GetGithubEndpointDefault {
|
||||
return &GetGithubEndpointDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetGithubEndpointDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type GetGithubEndpointDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get github endpoint default response has a 2xx status code
|
||||
func (o *GetGithubEndpointDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get github endpoint default response has a 3xx status code
|
||||
func (o *GetGithubEndpointDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get github endpoint default response has a 4xx status code
|
||||
func (o *GetGithubEndpointDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get github endpoint default response has a 5xx status code
|
||||
func (o *GetGithubEndpointDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this get github endpoint default response a status code equal to that given
|
||||
func (o *GetGithubEndpointDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the get github endpoint default response
|
||||
func (o *GetGithubEndpointDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *GetGithubEndpointDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/endpoints/{name}][%d] GetGithubEndpoint default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetGithubEndpointDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/endpoints/{name}][%d] GetGithubEndpoint default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetGithubEndpointDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetGithubEndpointDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
128
client/endpoints/list_github_endpoints_parameters.go
Normal file
128
client/endpoints/list_github_endpoints_parameters.go
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewListGithubEndpointsParams creates a new ListGithubEndpointsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewListGithubEndpointsParams() *ListGithubEndpointsParams {
|
||||
return &ListGithubEndpointsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListGithubEndpointsParamsWithTimeout creates a new ListGithubEndpointsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListGithubEndpointsParamsWithTimeout(timeout time.Duration) *ListGithubEndpointsParams {
|
||||
return &ListGithubEndpointsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListGithubEndpointsParamsWithContext creates a new ListGithubEndpointsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListGithubEndpointsParamsWithContext(ctx context.Context) *ListGithubEndpointsParams {
|
||||
return &ListGithubEndpointsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListGithubEndpointsParamsWithHTTPClient creates a new ListGithubEndpointsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListGithubEndpointsParamsWithHTTPClient(client *http.Client) *ListGithubEndpointsParams {
|
||||
return &ListGithubEndpointsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListGithubEndpointsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list github endpoints operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListGithubEndpointsParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list github endpoints params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListGithubEndpointsParams) WithDefaults() *ListGithubEndpointsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list github endpoints params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListGithubEndpointsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list github endpoints params
|
||||
func (o *ListGithubEndpointsParams) WithTimeout(timeout time.Duration) *ListGithubEndpointsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list github endpoints params
|
||||
func (o *ListGithubEndpointsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list github endpoints params
|
||||
func (o *ListGithubEndpointsParams) WithContext(ctx context.Context) *ListGithubEndpointsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list github endpoints params
|
||||
func (o *ListGithubEndpointsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list github endpoints params
|
||||
func (o *ListGithubEndpointsParams) WithHTTPClient(client *http.Client) *ListGithubEndpointsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list github endpoints params
|
||||
func (o *ListGithubEndpointsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListGithubEndpointsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
184
client/endpoints/list_github_endpoints_responses.go
Normal file
184
client/endpoints/list_github_endpoints_responses.go
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// ListGithubEndpointsReader is a Reader for the ListGithubEndpoints structure.
|
||||
type ListGithubEndpointsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListGithubEndpointsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListGithubEndpointsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewListGithubEndpointsDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewListGithubEndpointsOK creates a ListGithubEndpointsOK with default headers values
|
||||
func NewListGithubEndpointsOK() *ListGithubEndpointsOK {
|
||||
return &ListGithubEndpointsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListGithubEndpointsOK describes a response with status code 200, with default header values.
|
||||
|
||||
GithubEndpoints
|
||||
*/
|
||||
type ListGithubEndpointsOK struct {
|
||||
Payload garm_params.GithubEndpoints
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list github endpoints o k response has a 2xx status code
|
||||
func (o *ListGithubEndpointsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list github endpoints o k response has a 3xx status code
|
||||
func (o *ListGithubEndpointsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list github endpoints o k response has a 4xx status code
|
||||
func (o *ListGithubEndpointsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list github endpoints o k response has a 5xx status code
|
||||
func (o *ListGithubEndpointsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list github endpoints o k response a status code equal to that given
|
||||
func (o *ListGithubEndpointsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the list github endpoints o k response
|
||||
func (o *ListGithubEndpointsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ListGithubEndpointsOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/endpoints][%d] listGithubEndpointsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListGithubEndpointsOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/endpoints][%d] listGithubEndpointsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListGithubEndpointsOK) GetPayload() garm_params.GithubEndpoints {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListGithubEndpointsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListGithubEndpointsDefault creates a ListGithubEndpointsDefault with default headers values
|
||||
func NewListGithubEndpointsDefault(code int) *ListGithubEndpointsDefault {
|
||||
return &ListGithubEndpointsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListGithubEndpointsDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type ListGithubEndpointsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list github endpoints default response has a 2xx status code
|
||||
func (o *ListGithubEndpointsDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list github endpoints default response has a 3xx status code
|
||||
func (o *ListGithubEndpointsDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list github endpoints default response has a 4xx status code
|
||||
func (o *ListGithubEndpointsDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list github endpoints default response has a 5xx status code
|
||||
func (o *ListGithubEndpointsDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this list github endpoints default response a status code equal to that given
|
||||
func (o *ListGithubEndpointsDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the list github endpoints default response
|
||||
func (o *ListGithubEndpointsDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ListGithubEndpointsDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/endpoints][%d] ListGithubEndpoints default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListGithubEndpointsDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /github/endpoints][%d] ListGithubEndpoints default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListGithubEndpointsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListGithubEndpointsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
173
client/endpoints/update_github_endpoint_parameters.go
Normal file
173
client/endpoints/update_github_endpoint_parameters.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// NewUpdateGithubEndpointParams creates a new UpdateGithubEndpointParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewUpdateGithubEndpointParams() *UpdateGithubEndpointParams {
|
||||
return &UpdateGithubEndpointParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateGithubEndpointParamsWithTimeout creates a new UpdateGithubEndpointParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUpdateGithubEndpointParamsWithTimeout(timeout time.Duration) *UpdateGithubEndpointParams {
|
||||
return &UpdateGithubEndpointParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateGithubEndpointParamsWithContext creates a new UpdateGithubEndpointParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUpdateGithubEndpointParamsWithContext(ctx context.Context) *UpdateGithubEndpointParams {
|
||||
return &UpdateGithubEndpointParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateGithubEndpointParamsWithHTTPClient creates a new UpdateGithubEndpointParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUpdateGithubEndpointParamsWithHTTPClient(client *http.Client) *UpdateGithubEndpointParams {
|
||||
return &UpdateGithubEndpointParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateGithubEndpointParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the update github endpoint operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UpdateGithubEndpointParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when updating a GitHub endpoint.
|
||||
*/
|
||||
Body garm_params.UpdateGithubEndpointParams
|
||||
|
||||
/* Name.
|
||||
|
||||
The name of the GitHub endpoint.
|
||||
*/
|
||||
Name string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the update github endpoint params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateGithubEndpointParams) WithDefaults() *UpdateGithubEndpointParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the update github endpoint params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UpdateGithubEndpointParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) WithTimeout(timeout time.Duration) *UpdateGithubEndpointParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) WithContext(ctx context.Context) *UpdateGithubEndpointParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) WithHTTPClient(client *http.Client) *UpdateGithubEndpointParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) WithBody(body garm_params.UpdateGithubEndpointParams) *UpdateGithubEndpointParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) SetBody(body garm_params.UpdateGithubEndpointParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithName adds the name to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) WithName(name string) *UpdateGithubEndpointParams {
|
||||
o.SetName(name)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetName adds the name to the update github endpoint params
|
||||
func (o *UpdateGithubEndpointParams) SetName(name string) {
|
||||
o.Name = name
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UpdateGithubEndpointParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param name
|
||||
if err := r.SetPathParam("name", o.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
184
client/endpoints/update_github_endpoint_responses.go
Normal file
184
client/endpoints/update_github_endpoint_responses.go
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
garm_params "github.com/cloudbase/garm/params"
|
||||
)
|
||||
|
||||
// UpdateGithubEndpointReader is a Reader for the UpdateGithubEndpoint structure.
|
||||
type UpdateGithubEndpointReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UpdateGithubEndpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewUpdateGithubEndpointOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewUpdateGithubEndpointDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateGithubEndpointOK creates a UpdateGithubEndpointOK with default headers values
|
||||
func NewUpdateGithubEndpointOK() *UpdateGithubEndpointOK {
|
||||
return &UpdateGithubEndpointOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateGithubEndpointOK describes a response with status code 200, with default header values.
|
||||
|
||||
GithubEndpoint
|
||||
*/
|
||||
type UpdateGithubEndpointOK struct {
|
||||
Payload garm_params.GithubEndpoint
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update github endpoint o k response has a 2xx status code
|
||||
func (o *UpdateGithubEndpointOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update github endpoint o k response has a 3xx status code
|
||||
func (o *UpdateGithubEndpointOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update github endpoint o k response has a 4xx status code
|
||||
func (o *UpdateGithubEndpointOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update github endpoint o k response has a 5xx status code
|
||||
func (o *UpdateGithubEndpointOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this update github endpoint o k response a status code equal to that given
|
||||
func (o *UpdateGithubEndpointOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the update github endpoint o k response
|
||||
func (o *UpdateGithubEndpointOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *UpdateGithubEndpointOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /github/endpoints/{name}][%d] updateGithubEndpointOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateGithubEndpointOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /github/endpoints/{name}][%d] updateGithubEndpointOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateGithubEndpointOK) GetPayload() garm_params.GithubEndpoint {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateGithubEndpointOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewUpdateGithubEndpointDefault creates a UpdateGithubEndpointDefault with default headers values
|
||||
func NewUpdateGithubEndpointDefault(code int) *UpdateGithubEndpointDefault {
|
||||
return &UpdateGithubEndpointDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateGithubEndpointDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UpdateGithubEndpointDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this update github endpoint default response has a 2xx status code
|
||||
func (o *UpdateGithubEndpointDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this update github endpoint default response has a 3xx status code
|
||||
func (o *UpdateGithubEndpointDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this update github endpoint default response has a 4xx status code
|
||||
func (o *UpdateGithubEndpointDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this update github endpoint default response has a 5xx status code
|
||||
func (o *UpdateGithubEndpointDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this update github endpoint default response a status code equal to that given
|
||||
func (o *UpdateGithubEndpointDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the update github endpoint default response
|
||||
func (o *UpdateGithubEndpointDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *UpdateGithubEndpointDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /github/endpoints/{name}][%d] UpdateGithubEndpoint default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateGithubEndpointDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /github/endpoints/{name}][%d] UpdateGithubEndpoint default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateGithubEndpointDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UpdateGithubEndpointDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *CreateEnterprisePoolOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *CreateEnterprisePoolOK) Error() string {
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] createEnterprisePoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] createEnterprisePoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolOK) String() string {
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] createEnterprisePoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] createEnterprisePoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolOK) GetPayload() garm_params.Pool {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *CreateEnterprisePoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *CreateEnterprisePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] CreateEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] CreateEnterprisePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolDefault) String() string {
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] CreateEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] CreateEnterprisePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *CreateEnterpriseOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *CreateEnterpriseOK) Error() string {
|
||||
return fmt.Sprintf("[POST /enterprises][%d] createEnterpriseOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /enterprises][%d] createEnterpriseOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseOK) String() string {
|
||||
return fmt.Sprintf("[POST /enterprises][%d] createEnterpriseOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /enterprises][%d] createEnterpriseOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseOK) GetPayload() garm_params.Enterprise {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *CreateEnterpriseDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *CreateEnterpriseDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /enterprises][%d] CreateEnterprise default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /enterprises][%d] CreateEnterprise default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseDefault) String() string {
|
||||
return fmt.Sprintf("[POST /enterprises][%d] CreateEnterprise default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /enterprises][%d] CreateEnterprise default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -81,11 +82,13 @@ func (o *DeleteEnterprisePoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *DeleteEnterprisePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}/pools/{poolID}][%d] DeleteEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}/pools/{poolID}][%d] DeleteEnterprisePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteEnterprisePoolDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}/pools/{poolID}][%d] DeleteEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}/pools/{poolID}][%d] DeleteEnterprisePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -81,11 +82,13 @@ func (o *DeleteEnterpriseDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *DeleteEnterpriseDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}][%d] DeleteEnterprise default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}][%d] DeleteEnterprise default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteEnterpriseDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}][%d] DeleteEnterprise default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}][%d] DeleteEnterprise default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package enterprises
|
|||
|
||||
import (
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
|
|
@ -15,6 +16,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi
|
|||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new enterprises API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new enterprises API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for enterprises API
|
||||
*/
|
||||
|
|
@ -23,7 +49,7 @@ type Client struct {
|
|||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *GetEnterprisePoolOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetEnterprisePoolOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] getEnterprisePoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] getEnterprisePoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] getEnterprisePoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] getEnterprisePoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolOK) GetPayload() garm_params.Pool {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *GetEnterprisePoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetEnterprisePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] GetEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] GetEnterprisePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] GetEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] GetEnterprisePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *GetEnterpriseOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetEnterpriseOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] getEnterpriseOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] getEnterpriseOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] getEnterpriseOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] getEnterpriseOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseOK) GetPayload() garm_params.Enterprise {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *GetEnterpriseDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetEnterpriseDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] GetEnterprise default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] GetEnterprise default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] GetEnterprise default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] GetEnterprise default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *ListEnterpriseInstancesOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] listEnterpriseInstancesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] listEnterpriseInstancesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] listEnterpriseInstancesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] listEnterpriseInstancesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesOK) GetPayload() garm_params.Instances {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *ListEnterpriseInstancesDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] ListEnterpriseInstances default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] ListEnterpriseInstances default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] ListEnterpriseInstances default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] ListEnterpriseInstances default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterpriseInstancesDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *ListEnterprisePoolsOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListEnterprisePoolsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] listEnterprisePoolsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] listEnterprisePoolsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] listEnterprisePoolsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] listEnterprisePoolsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsOK) GetPayload() garm_params.Pools {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *ListEnterprisePoolsDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListEnterprisePoolsDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] ListEnterprisePools default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] ListEnterprisePools default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] ListEnterprisePools default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] ListEnterprisePools default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisePoolsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *ListEnterprisesOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListEnterprisesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises][%d] listEnterprisesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises][%d] listEnterprisesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesOK) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises][%d] listEnterprisesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises][%d] listEnterprisesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesOK) GetPayload() garm_params.Enterprises {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *ListEnterprisesDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListEnterprisesDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /enterprises][%d] ListEnterprises default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises][%d] ListEnterprises default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesDefault) String() string {
|
||||
return fmt.Sprintf("[GET /enterprises][%d] ListEnterprises default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /enterprises][%d] ListEnterprises default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListEnterprisesDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *UpdateEnterprisePoolOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] updateEnterprisePoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] updateEnterprisePoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolOK) String() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] updateEnterprisePoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] updateEnterprisePoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolOK) GetPayload() garm_params.Pool {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *UpdateEnterprisePoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] UpdateEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] UpdateEnterprisePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolDefault) String() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] UpdateEnterprisePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] UpdateEnterprisePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package enterprises
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *UpdateEnterpriseOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *UpdateEnterpriseOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] updateEnterpriseOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] updateEnterpriseOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseOK) String() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] updateEnterpriseOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] updateEnterpriseOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseOK) GetPayload() garm_params.Enterprise {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *UpdateEnterpriseDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *UpdateEnterpriseDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] UpdateEnterprise default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] UpdateEnterprise default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseDefault) String() string {
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] UpdateEnterprise default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] UpdateEnterprise default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
|
|
@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi
|
|||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new first run API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new first run API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for first run API
|
||||
*/
|
||||
|
|
@ -25,7 +51,7 @@ type Client struct {
|
|||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package first_run
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -86,11 +87,13 @@ func (o *FirstRunOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *FirstRunOK) Error() string {
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *FirstRunOK) String() string {
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *FirstRunOK) GetPayload() garm_params.User {
|
||||
|
|
@ -152,11 +155,13 @@ func (o *FirstRunBadRequest) Code() int {
|
|||
}
|
||||
|
||||
func (o *FirstRunBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunBadRequest %+v", 400, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *FirstRunBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunBadRequest %+v", 400, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /first-run][%d] firstRunBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *FirstRunBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@ import (
|
|||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/cloudbase/garm/client/controller"
|
||||
"github.com/cloudbase/garm/client/controller_info"
|
||||
"github.com/cloudbase/garm/client/credentials"
|
||||
"github.com/cloudbase/garm/client/endpoints"
|
||||
"github.com/cloudbase/garm/client/enterprises"
|
||||
"github.com/cloudbase/garm/client/first_run"
|
||||
"github.com/cloudbase/garm/client/instances"
|
||||
|
|
@ -66,8 +68,10 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *GarmAPI {
|
|||
|
||||
cli := new(GarmAPI)
|
||||
cli.Transport = transport
|
||||
cli.Controller = controller.New(transport, formats)
|
||||
cli.ControllerInfo = controller_info.New(transport, formats)
|
||||
cli.Credentials = credentials.New(transport, formats)
|
||||
cli.Endpoints = endpoints.New(transport, formats)
|
||||
cli.Enterprises = enterprises.New(transport, formats)
|
||||
cli.FirstRun = first_run.New(transport, formats)
|
||||
cli.Instances = instances.New(transport, formats)
|
||||
|
|
@ -122,10 +126,14 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
|||
|
||||
// GarmAPI is a client for garm API
|
||||
type GarmAPI struct {
|
||||
Controller controller.ClientService
|
||||
|
||||
ControllerInfo controller_info.ClientService
|
||||
|
||||
Credentials credentials.ClientService
|
||||
|
||||
Endpoints endpoints.ClientService
|
||||
|
||||
Enterprises enterprises.ClientService
|
||||
|
||||
FirstRun first_run.ClientService
|
||||
|
|
@ -152,8 +160,10 @@ type GarmAPI struct {
|
|||
// SetTransport changes the transport on the client and all its subresources
|
||||
func (c *GarmAPI) SetTransport(transport runtime.ClientTransport) {
|
||||
c.Transport = transport
|
||||
c.Controller.SetTransport(transport)
|
||||
c.ControllerInfo.SetTransport(transport)
|
||||
c.Credentials.SetTransport(transport)
|
||||
c.Endpoints.SetTransport(transport)
|
||||
c.Enterprises.SetTransport(transport)
|
||||
c.FirstRun.SetTransport(transport)
|
||||
c.Instances.SetTransport(transport)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,12 @@ DeleteInstanceParams contains all the parameters to send to the API endpoint
|
|||
*/
|
||||
type DeleteInstanceParams struct {
|
||||
|
||||
/* BypassGHUnauthorized.
|
||||
|
||||
If true GARM will ignore unauthorized errors returned by GitHub when removing a runner. This is useful if you want to clean up runners and your credentials have expired.
|
||||
*/
|
||||
BypassGHUnauthorized *bool
|
||||
|
||||
/* ForceRemove.
|
||||
|
||||
If true GARM will ignore any provider error when removing the runner and will continue to remove the runner from github and the GARM database.
|
||||
|
|
@ -127,6 +133,17 @@ func (o *DeleteInstanceParams) SetHTTPClient(client *http.Client) {
|
|||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBypassGHUnauthorized adds the bypassGHUnauthorized to the delete instance params
|
||||
func (o *DeleteInstanceParams) WithBypassGHUnauthorized(bypassGHUnauthorized *bool) *DeleteInstanceParams {
|
||||
o.SetBypassGHUnauthorized(bypassGHUnauthorized)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBypassGHUnauthorized adds the bypassGHUnauthorized to the delete instance params
|
||||
func (o *DeleteInstanceParams) SetBypassGHUnauthorized(bypassGHUnauthorized *bool) {
|
||||
o.BypassGHUnauthorized = bypassGHUnauthorized
|
||||
}
|
||||
|
||||
// WithForceRemove adds the forceRemove to the delete instance params
|
||||
func (o *DeleteInstanceParams) WithForceRemove(forceRemove *bool) *DeleteInstanceParams {
|
||||
o.SetForceRemove(forceRemove)
|
||||
|
|
@ -157,6 +174,23 @@ func (o *DeleteInstanceParams) WriteToRequest(r runtime.ClientRequest, reg strfm
|
|||
}
|
||||
var res []error
|
||||
|
||||
if o.BypassGHUnauthorized != nil {
|
||||
|
||||
// query param bypassGHUnauthorized
|
||||
var qrBypassGHUnauthorized bool
|
||||
|
||||
if o.BypassGHUnauthorized != nil {
|
||||
qrBypassGHUnauthorized = *o.BypassGHUnauthorized
|
||||
}
|
||||
qBypassGHUnauthorized := swag.FormatBool(qrBypassGHUnauthorized)
|
||||
if qBypassGHUnauthorized != "" {
|
||||
|
||||
if err := r.SetQueryParam("bypassGHUnauthorized", qBypassGHUnauthorized); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.ForceRemove != nil {
|
||||
|
||||
// query param forceRemove
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package instances
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -81,11 +82,13 @@ func (o *DeleteInstanceDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *DeleteInstanceDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /instances/{instanceName}][%d] DeleteInstance default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /instances/{instanceName}][%d] DeleteInstance default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteInstanceDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /instances/{instanceName}][%d] DeleteInstance default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /instances/{instanceName}][%d] DeleteInstance default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteInstanceDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package instances
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *GetInstanceOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetInstanceOK) Error() string {
|
||||
return fmt.Sprintf("[GET /instances/{instanceName}][%d] getInstanceOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /instances/{instanceName}][%d] getInstanceOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetInstanceOK) String() string {
|
||||
return fmt.Sprintf("[GET /instances/{instanceName}][%d] getInstanceOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /instances/{instanceName}][%d] getInstanceOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetInstanceOK) GetPayload() garm_params.Instance {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *GetInstanceDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetInstanceDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /instances/{instanceName}][%d] GetInstance default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /instances/{instanceName}][%d] GetInstance default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetInstanceDefault) String() string {
|
||||
return fmt.Sprintf("[GET /instances/{instanceName}][%d] GetInstance default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /instances/{instanceName}][%d] GetInstance default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetInstanceDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package instances
|
|||
|
||||
import (
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
|
|
@ -15,6 +16,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi
|
|||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new instances API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new instances API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for instances API
|
||||
*/
|
||||
|
|
@ -23,7 +49,7 @@ type Client struct {
|
|||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package instances
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *ListInstancesOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListInstancesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /instances][%d] listInstancesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /instances][%d] listInstancesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListInstancesOK) String() string {
|
||||
return fmt.Sprintf("[GET /instances][%d] listInstancesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /instances][%d] listInstancesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListInstancesOK) GetPayload() garm_params.Instances {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *ListInstancesDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListInstancesDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /instances][%d] ListInstances default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /instances][%d] ListInstances default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListInstancesDefault) String() string {
|
||||
return fmt.Sprintf("[GET /instances][%d] ListInstances default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /instances][%d] ListInstances default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListInstancesDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package instances
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *ListPoolInstancesOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListPoolInstancesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] listPoolInstancesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] listPoolInstancesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesOK) String() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] listPoolInstancesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] listPoolInstancesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesOK) GetPayload() garm_params.Instances {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *ListPoolInstancesDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListPoolInstancesDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] ListPoolInstances default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] ListPoolInstances default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesDefault) String() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] ListPoolInstances default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools/{poolID}/instances][%d] ListPoolInstances default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolInstancesDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
|
|
@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi
|
|||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new jobs API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new jobs API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for jobs API
|
||||
*/
|
||||
|
|
@ -25,7 +51,7 @@ type Client struct {
|
|||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package jobs
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -86,11 +87,13 @@ func (o *ListJobsOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListJobsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListJobsOK) String() string {
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListJobsOK) GetPayload() garm_params.Jobs {
|
||||
|
|
@ -152,11 +155,13 @@ func (o *ListJobsBadRequest) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListJobsBadRequest) Error() string {
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsBadRequest %+v", 400, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *ListJobsBadRequest) String() string {
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsBadRequest %+v", 400, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /jobs][%d] listJobsBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *ListJobsBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
|
|
@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi
|
|||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new login API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new login API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for login API
|
||||
*/
|
||||
|
|
@ -25,7 +51,7 @@ type Client struct {
|
|||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package login
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -86,11 +87,13 @@ func (o *LoginOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *LoginOK) Error() string {
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *LoginOK) String() string {
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *LoginOK) GetPayload() garm_params.JWTResponse {
|
||||
|
|
@ -152,11 +155,13 @@ func (o *LoginBadRequest) Code() int {
|
|||
}
|
||||
|
||||
func (o *LoginBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginBadRequest %+v", 400, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *LoginBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginBadRequest %+v", 400, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /auth/login][%d] loginBadRequest %s", 400, payload)
|
||||
}
|
||||
|
||||
func (o *LoginBadRequest) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package metrics_token
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -86,11 +87,13 @@ func (o *GetMetricsTokenOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetMetricsTokenOK) Error() string {
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenOK) String() string {
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenOK) GetPayload() garm_params.JWTResponse {
|
||||
|
|
@ -152,11 +155,13 @@ func (o *GetMetricsTokenUnauthorized) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetMetricsTokenUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenUnauthorized %+v", 401, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenUnauthorized) String() string {
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenUnauthorized %+v", 401, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /metrics-token][%d] getMetricsTokenUnauthorized %s", 401, payload)
|
||||
}
|
||||
|
||||
func (o *GetMetricsTokenUnauthorized) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
|
|
@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi
|
|||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new metrics token API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new metrics token API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for metrics token API
|
||||
*/
|
||||
|
|
@ -25,7 +51,7 @@ type Client struct {
|
|||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *CreateOrgPoolOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *CreateOrgPoolOK) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] createOrgPoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] createOrgPoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolOK) String() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] createOrgPoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] createOrgPoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolOK) GetPayload() garm_params.Pool {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *CreateOrgPoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *CreateOrgPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] CreateOrgPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] CreateOrgPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolDefault) String() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] CreateOrgPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/pools][%d] CreateOrgPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *CreateOrgOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *CreateOrgOK) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations][%d] createOrgOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations][%d] createOrgOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgOK) String() string {
|
||||
return fmt.Sprintf("[POST /organizations][%d] createOrgOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations][%d] createOrgOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgOK) GetPayload() garm_params.Organization {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *CreateOrgDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *CreateOrgDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations][%d] CreateOrg default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations][%d] CreateOrg default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgDefault) String() string {
|
||||
return fmt.Sprintf("[POST /organizations][%d] CreateOrg default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations][%d] CreateOrg default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *CreateOrgDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -81,11 +82,13 @@ func (o *DeleteOrgPoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *DeleteOrgPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/pools/{poolID}][%d] DeleteOrgPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/pools/{poolID}][%d] DeleteOrgPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteOrgPoolDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/pools/{poolID}][%d] DeleteOrgPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/pools/{poolID}][%d] DeleteOrgPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteOrgPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -81,11 +82,13 @@ func (o *DeleteOrgDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *DeleteOrgDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}][%d] DeleteOrg default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}][%d] DeleteOrg default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteOrgDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}][%d] DeleteOrg default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}][%d] DeleteOrg default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeleteOrgDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *GetOrgPoolOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetOrgPoolOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] getOrgPoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] getOrgPoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] getOrgPoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] getOrgPoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolOK) GetPayload() garm_params.Pool {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *GetOrgPoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetOrgPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] GetOrgPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] GetOrgPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] GetOrgPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools/{poolID}][%d] GetOrgPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *GetOrgOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetOrgOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] getOrgOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] getOrgOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] getOrgOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] getOrgOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgOK) GetPayload() garm_params.Organization {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *GetOrgDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetOrgDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] GetOrg default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] GetOrg default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] GetOrg default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}][%d] GetOrg default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *GetOrgWebhookInfoOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetOrgWebhookInfoOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/webhook][%d] getOrgWebhookInfoOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/webhook][%d] getOrgWebhookInfoOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgWebhookInfoOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/webhook][%d] getOrgWebhookInfoOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/webhook][%d] getOrgWebhookInfoOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgWebhookInfoOK) GetPayload() garm_params.HookInfo {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *GetOrgWebhookInfoDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetOrgWebhookInfoDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/webhook][%d] GetOrgWebhookInfo default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/webhook][%d] GetOrgWebhookInfo default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgWebhookInfoDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/webhook][%d] GetOrgWebhookInfo default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/webhook][%d] GetOrgWebhookInfo default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetOrgWebhookInfoDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *InstallOrgWebhookOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *InstallOrgWebhookOK) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] installOrgWebhookOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] installOrgWebhookOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookOK) String() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] installOrgWebhookOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] installOrgWebhookOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookOK) GetPayload() garm_params.HookInfo {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *InstallOrgWebhookDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *InstallOrgWebhookDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] InstallOrgWebhook default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] InstallOrgWebhook default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookDefault) String() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] InstallOrgWebhook default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] InstallOrgWebhook default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *ListOrgInstancesOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListOrgInstancesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] listOrgInstancesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] listOrgInstancesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] listOrgInstancesOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] listOrgInstancesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesOK) GetPayload() garm_params.Instances {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *ListOrgInstancesDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListOrgInstancesDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] ListOrgInstances default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] ListOrgInstances default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] ListOrgInstances default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/instances][%d] ListOrgInstances default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgInstancesDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *ListOrgPoolsOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListOrgPoolsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] listOrgPoolsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] listOrgPoolsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] listOrgPoolsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] listOrgPoolsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsOK) GetPayload() garm_params.Pools {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *ListOrgPoolsDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListOrgPoolsDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] ListOrgPools default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] ListOrgPools default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] ListOrgPools default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations/{orgID}/pools][%d] ListOrgPools default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgPoolsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *ListOrgsOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListOrgsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations][%d] listOrgsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations][%d] listOrgsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgsOK) String() string {
|
||||
return fmt.Sprintf("[GET /organizations][%d] listOrgsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations][%d] listOrgsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgsOK) GetPayload() garm_params.Organizations {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *ListOrgsDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListOrgsDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /organizations][%d] ListOrgs default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations][%d] ListOrgs default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgsDefault) String() string {
|
||||
return fmt.Sprintf("[GET /organizations][%d] ListOrgs default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /organizations][%d] ListOrgs default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListOrgsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package organizations
|
|||
|
||||
import (
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
|
|
@ -15,6 +16,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi
|
|||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new organizations API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new organizations API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for organizations API
|
||||
*/
|
||||
|
|
@ -23,7 +49,7 @@ type Client struct {
|
|||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption is the option for Client methods
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -81,11 +82,13 @@ func (o *UninstallOrgWebhookDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *UninstallOrgWebhookDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/webhook][%d] UninstallOrgWebhook default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/webhook][%d] UninstallOrgWebhook default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UninstallOrgWebhookDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/webhook][%d] UninstallOrgWebhook default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/webhook][%d] UninstallOrgWebhook default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UninstallOrgWebhookDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *UpdateOrgPoolOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *UpdateOrgPoolOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] updateOrgPoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] updateOrgPoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolOK) String() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] updateOrgPoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] updateOrgPoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolOK) GetPayload() garm_params.Pool {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *UpdateOrgPoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *UpdateOrgPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] UpdateOrgPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] UpdateOrgPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolDefault) String() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] UpdateOrgPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}/pools/{poolID}][%d] UpdateOrgPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package organizations
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *UpdateOrgOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *UpdateOrgOK) Error() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] updateOrgOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] updateOrgOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgOK) String() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] updateOrgOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] updateOrgOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgOK) GetPayload() garm_params.Organization {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *UpdateOrgDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *UpdateOrgDefault) Error() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] UpdateOrg default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] UpdateOrg default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgDefault) String() string {
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] UpdateOrg default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PUT /organizations/{orgID}][%d] UpdateOrg default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *UpdateOrgDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package pools
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -81,11 +82,13 @@ func (o *DeletePoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *DeletePoolDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /pools/{poolID}][%d] DeletePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /pools/{poolID}][%d] DeletePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeletePoolDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /pools/{poolID}][%d] DeletePool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[DELETE /pools/{poolID}][%d] DeletePool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *DeletePoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package pools
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *GetPoolOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetPoolOK) Error() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] getPoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] getPoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetPoolOK) String() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] getPoolOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] getPoolOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *GetPoolOK) GetPayload() garm_params.Pool {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *GetPoolDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *GetPoolDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] GetPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] GetPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetPoolDefault) String() string {
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] GetPool default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools/{poolID}][%d] GetPool default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *GetPoolDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package pools
|
|||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
|
@ -87,11 +88,13 @@ func (o *ListPoolsOK) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListPoolsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /pools][%d] listPoolsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools][%d] listPoolsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolsOK) String() string {
|
||||
return fmt.Sprintf("[GET /pools][%d] listPoolsOK %+v", 200, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools][%d] listPoolsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolsOK) GetPayload() garm_params.Pools {
|
||||
|
|
@ -157,11 +160,13 @@ func (o *ListPoolsDefault) Code() int {
|
|||
}
|
||||
|
||||
func (o *ListPoolsDefault) Error() string {
|
||||
return fmt.Sprintf("[GET /pools][%d] ListPools default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools][%d] ListPools default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolsDefault) String() string {
|
||||
return fmt.Sprintf("[GET /pools][%d] ListPools default %+v", o._statusCode, o.Payload)
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /pools][%d] ListPools default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ListPoolsDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
|
|
|
|||
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